Creates nuget packages for projects and distributes them
- Visual Studio (17+)
Download them.
In the example a build
folder is used in the repo
For the programs that are used:
- VSPostBuildParameterCollector.exe →
build/prog/VSPostBuildParameterCollector
- CustomNuGetBuilder.exe →
build/prog/CustomNuGetBuilder
- lib/* →
build/prog/CustomNuGetBuilder/lib/*
- lib/* →
- Create a
build/config
folder - Open a CLI and navigate into your
build/prog/CustomNuGetBuilder
folder
cd <PathToYourVSSolutionLocation>/build/prog/CustomNuGetBuilder
- Create a
config.json
CustomNuGetBuilder.exe -genconf config.json
- Copy the
build/prog/CustomNuGetBuilder/config.json
intobuild/config/config.json
Now you should have something like that:
config.json
{
"Username": "CustomNuGetBuilder", //Username that is used by the program e.g. BuildTool-<YourUsernam>
"Email": "example@example.example", //Email that is uesd by the programm e.g. [github]@<YourUsername>
"BuildNugetConfig": {
"ExeDownloadPath": "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", //Update and download-location of nuget.exe
"ExePath": "nuget.exe", //Path for Execution
"AutoUpdate": true,
"ExecCommand": "nuget pack \"$(ProjectPath)\" -Properties Configuration=$(ConfigurationName) -IncludeReferencedProjects -Verbosity detailed -ForceEnglishOutput", //Command to create the nugetfile
"LatestBuildDir": "builds\\latest", //Output directory
"ArchiveBuildDir": "builds\\archiv" //Archiv for old output files
},
"AppendToGitRepoConfig": {
"Enabled": false, //true - Append created nuget-file into a git repo and push it
"CredsPrincipal": null, // Username or Token
"CredsPassword": null, // Password (if you use a token let this filed empty)
"LocalGitDir": "git\\repo", //Localpath
"RemoteGitPath": null //Remote path e.g. https://<hosturl>/<ownername>/<reponame>.git
},
"GitHubReleaseConfig": {
"Enabled": false, //true - Automatically create a Github that contains the created files
"GitHubPersonalAccessToken": "", // GitHub Personal Access Token
"LocalRepoPath": null, //null - Program is executed inside a repo
"CheckIfLocalRepoIsDirty": false, //Throws an exception if the (local) repo contains uncommited changes
"RemoteHead": "origin", //Head that is used too connect to GitHub-Remote
"AllowedReleaseBranches": null, //e.g. [ "master", "develop" ] --> if the current build doesn't occurs on one of the given branches, a exception will be thrown
"IsPreRealease": true, //create the release as pre release
"IsDraft": true, //create the release as draft
"AssetUploadTimeOut": "00:05:00" //Max UploadTime per Asset - throws an Exception if it takes to long
}
}
Project-Properties\Buildevents\Postbuild
cd $(SolutionDir)build
for /f "delims=" %%i in ('prog\VSPostBuildParameterCollector\VSPostBuildParameterCollector.exe --OutDir "$(OutDir)\" --ConfigurationName "$(ConfigurationName)" --ProjectName "$(ProjectName)" --TargetName "$(TargetName)" --TargetPath "$(TargetPath)" --ProjectPath "$(ProjectPath)" --ProjectFileName "$(ProjectFileName)" --TargetExt "$(TargetExt)" --TargetFileName "$(TargetFileName)" --DevEnvDir "$(DevEnvDir)\" --TargetDir "$(TargetDir)\" --ProjectDir "$(ProjectDir)\" --SolutionFileName "$(SolutionFileName)" --SolutionPath "$(SolutionPath)" --SolutionDir "$(SolutionDir)\" --SolutionName "$(SolutionName)" --PlatformName "$(PlatformName)" --ProjectExt "$(ProjectExt)" --SolutionExt "$(SolutionExt)"') do set PARVAR=%%i
prog\CustomNuGetBuilder\CustomNuGetBuilder.exe -c "conf\config.json" -p %PARVAR%
This is an old project which was created some time ago.
It was migrated to NET Core (should work now properly) and is now archived as OSS, so everyone can learn from it 📖