简体   繁体   中英

Set Nuget Package Version from Project Info

My setup is rather simple: MyGet pulls my repo from GitHub on commit and builds. I then manually push the successfully built project to NuGet.

The version is manually set except for the build counter. Is there a way to pull the version from the AssemblyInfo, .csproj file or somewhere else?

I've read the docs and the only thing I can find is using GitVersion and a build file. I'm hoping there's a cleaner/simpler way, eg %project_version% :)

By definition, a build counter is managed by the build system and can only be reset at best.

To use the version from AssemblyInfo.cs as the NuGet package version, you could create a .nuspec manifest next to your .csproj file (give it the same file name only differing by extension), and use the $version$ placeholder.

I've got a blog post that explains this in further detail: https://www.xavierdecoster.com/post/2012/04/26/nuget-version-token-explained.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM