Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Question: How to version dotnet core assemblies #1098
Forgive me if this is not the appropriate channel for a question. I'm trying to figure out how to version (and retrieve) assembly versions in dotnet core (both build and publish). I've been searching for documentation on this, but I've come up empty. Below are some things I've tried.
I'm retrieving the version using the following code:
Can anyone point out what I'm doing wrong, or point me in the direction of a page that explains some of this stuff more fully?
The code you wrote inspects assembly version (defined by AssemblyVersionAttribute).
I don't know what the
@golfguy0082 net core is not different than the full framework. you can set the assembly version in your assembly by adding the attributes like
[assembly: AssemblyVersion("184.108.40.206")] [assembly: AssemblyFileVersion("220.127.116.11")]
and the way you are calling Assembly class to get the version is correct. The example in the link https://msdn.microsoft.com/en-us/library/system.reflection.assembly(v=vs.110).aspx is demonstrating that
.NET Core tooling is a little different because we have enabled folks to set the value in msbuild properties directly. @golfguy0082 have a look at #2 which is I think the closest set of documentation that I can find on the matter.
I'll move this issue to the SDK repo per Wes comment
Thank you all! Especially @weshaggard and @dasMulli! After some more investigation, it looks like I'm seeing the same issue that @dasMulli describes in #967 . It also sounds like the answer to my original question is "the 'officially recommended' way to version .net core assemblies (at least from msbuild's perspective) is still in-flux".
Perhaps my best bet right now is to simply omit the
How can I achieve auto increment of the assembly version like we could with
Any ideas please?
Though the error message does not help with figuring that out, so I have opened an issue about that: dotnet/roslyn#22660.