Nuget/MsBuild
A simple cmd file to build a project (or solution) into a nuget structure. MsBuild is used to build the project in release configuration and put it directly into the package lib/netX folder.
echo off Set VersionDefault=1.0.0.0 echo. echo ** Nuget Pack using version = %VersionDefault% ** set /p Version=Version number [%VersionDefault%] if "%Version%" == "" set Version=%VersionDefault% echo ver=[%Version%] :: nuget pack nuget Update -self %systemroot%\Microsoft.Net\Framework\v4.0.30319\MSBuild.exe ..\MyPackage\MyPackage.csproj /p:Configuration=Release /p:OutputPath=..\Nuget\MyPackage\lib\net20 nuget pack MyPackage\MyPackage.nuspec -Version %Version% pause :end
Folder structure:
- Nuget
- Nuget.exe
- pack.cmd (see below)
- *.nupkg files
- MyPackage
- MyPackage.nuspec
- Readme.txt
- content
- Web.config.transform
- lib
- net20
- *.dll here
- net20
Build with devenv
Deployment projects need VS2010. Create a x.VS2010.sln with those vdproj projects, and use a script like this (so you never need to actually launch VS2010).
@echo "Building with VS2010" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com" "C:\Dev\z\z.2010.sln" /rebuild Release /project "z.Setup\z.Setup.vdproj" /projectconfig Release @echo "Copying the MSIs to somewhere useful" copy "C:\Dev\z\z.Setup\Release\z.Setup.msi" "C:\Dev\latest_Releases\z.Setup.msi" @pause
Build a solution
Create a nuspec for the project(s) in the solution- as nuget pack calls the csproj, tokens like $Version$ are automatically filled from the dll
nuget.exe update -self nuget.exe restore MySolution.sln %systemroot%\Microsoft.Net\Framework\v4.0.30319\MSBuild.exe MySolution.sln /t:Build /p:Configuration=Release nuget.exe pack Lib\Lib.csproj -OutputDirectory Packages -Prop Configuration=Release