If you're running Windows 10 or later, install from PowerShell Gallery:
PS> PowerShellGet\Install-Module csproj
On Windows 8, you'll neeed to install PackageManagement manually (using psbootstrap) to be able to use Install-Module
:
PS> ((New-Object System.Net.WebClient).DownloadString('https://bit.ly/psbootstrap')) | out-file "$env:localappdata/ps-bootstrap/bootstrap.ps1"; & "$env:localappdata/ps-bootstrap/bootstrap.ps1"
PS> PowerShellGet\Install-Module csproj
PS> import-module csproj
PS> cd "src/myproject"
PS> Push-Nuget -build -source https://www.nuget.org/api/v2/package
This will:
- find csproj file in src/my.project
- update version in Properties/AssemblyInfo.cs, according to Versioning convention
- build it
- pack nuget, by invoking
nuget pack
- push nuget, by invoking
nuget push
Other usefull parameters:
-Stable
- generate a stable nuget version (without suffix)-IncrementVersion
- incrememtpatch
version component-Suffux
- manually set version suffix
PS> cd "reporoot"
PS> push-nugets -project "My.Project","Other.Project" -build -source https://www.nuget.org/api/v2/package
This will:
- scan your repo for
*.csproj
files (this is done only once and cached in.projects.json
file) - invoke
push-nuget
with provided parameters for every project given in-project
Other usefull parameters:
-allowNoNuspec
- allow pushing of packages without a .nuspec file-scan
- rescan repo directory for projects
- Make sure the project you're trying to convert is installed as a nuget:
PS> nuget install "Project.To.Convert" -out "packages"
- Convert all references to that projects:
PS> import-module csproj
PS> tonuget "path\to\my\solution.sln" -projectName "Project.To.Convert" -packagesDir "packages"
This will:
- scan all
csproj
files referenced bysolution.sln
- replace all project references to
Project.To.Convert
with nuget references topackages\Project.To.Convert.LatestVersion
- remove
Project.To.Convert
fromsolution.sln
We try to follow GitVersion as close as possible, while keeping compatibility with nuget.
The version template looks like this:
major.minor.patch-{branch-name}{buildno}-{commit hash}
{branch-name}
and{commit hash}
will be filled if project is under version control by Git or Mercurial{buildno}
is incremented each time you callpush-nuget -build
- whole suffix part is limited to 20 chars: 10 for branch, 3 fro buildno, 6 for commit hash
-
Initialize dependencies:
npm run init
-
Test:
npm test