dotnet / standard

This repo is building the .NET Standard
3.07k stars 428 forks source link

Confusing behavior when using AssemblyInfo.cs #1775

Closed Korporal closed 2 years ago

Korporal commented 4 years ago

I'm completely perplexed.

I created a .Net Standard 2.0 library project.

I explicity added an AssemblyInfo.cs file, we need this because we use this utility to "stamp" our assemblies when we build them:

https://github.com/ygoe/NetRevisionTool

That utility is run as a pre/post build event and temporarily replaces placeholders in the AssemblyInformationalVersion attribute with runtime values (like repo folder name, commit ID, branch etc etc).

The completed assembly then has this info "burned" into it as we go forward.

.Net Standard is not working with this.

  1. It seems to populatethe Package Version (in the project's Package section) with whatever we put into AssemblyInfo.cs for AssemblyInformationalVersion.
  2. The version of the generated nuget package is always set as 1.0.0.

This is just mind blowing, is there no way we can do this seemingly simple operation any more if adopt .Net Standard?

Korporal commented 4 years ago

Hmm I may have just found the answer, seems theses guys created NetRevisionTask that does something for/with .Net Standard/Core.

adnkai commented 4 years ago

A workaround is setting the assemblyInfos in your .csproj

`

1.1.0.0

`

terrajobst commented 2 years ago

This is by-design and behavior of SDK style projects. Closing as by-design.