NetRevisionTask icon indicating copy to clipboard operation
NetRevisionTask copied to clipboard

NrtRevisionFormat no longer works as expected with VS2022 v17.8.3

Open kiddailey opened this issue 1 year ago • 5 comments

Just upgraded to VS2022 v17.8.3 and have discovered that my NrtRevisionFormat has stopped working as expected.

For example:

<NrtRevisionFormat>1.0.{revnum} ({chash:5})</NrtRevisionFormat>

The expected result is something like

1.0.1234 (e5a12)

However, I'm now seeing the expected result followed by the full hash. For example:

1.0.1234 (e5a12)+e5a12af0c8f4332982a76c8a4937fb9afdf571d4

More specifically, this is "ProductVersion." The FileVersion property is just the base (1.0.1234) without the hash.

This has worked great for years and nothing else has changed aside from the VS update. For now, I'm manually truncating the value myself, which works but feels broken.

Any thoughts?

kiddailey avatar Dec 12 '23 20:12 kiddailey

I will have to take a look after upgrading to VS 17.8 myself. I was going to explore .NET 8 a bit but not so soon. At least they already have a few point releases out so the biggest issues should be fixed by now. Maybe the new SDK comes with other variables/properties in MSBuild that need to be used now.

ygoe avatar Dec 12 '23 21:12 ygoe

Appreciate the reply. No rush -- like I said, I was able to truncate the value as a work-around. I can confirm that it's definitely something with the update. I just upgraded my secondary dev machine and it I got the exact same results.

Edit: I just realized my initial post had the example buggy output wrong. I had part of it duplicated on accident and I've corrected it.

kiddailey avatar Dec 15 '23 05:12 kiddailey

Experiencing this since installing .net8 on system, despite building for .net6 at the moment. Happens in Windows or Linux build environments with .net8 installed. I'm using JetBrains Rider, fwiw.

<NrtRevisionFormat>{semvertag}</NrtRevisionFormat>

Previously (and currently on system without .net8 sdk installed) would get the expected version based on the git tag, such as 1.515.1-main.3

Now I get:

1.514.1-main.11+a3d8e158021f0ff1af4d0d3e48a0c3329b4270b9

i.e. the hash is added.

mattheweshleman avatar Dec 15 '23 17:12 mattheweshleman

Seems to be new in .NET 8.0 linked to the SourceLink features...

.NET 8.0 - What's new: https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-8#source-link

Workaround/Fix found here: https://github.com/dotnet/sdk/issues/34568#issuecomment-1832805087

tl;dr: Add following in a <PropertyGroup/> within your directory.build.props or .csproj file.

<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>

You could add this line below here: https://github.com/ygoe/NetRevisionTask/blob/0657dc838261b1ec3b4a00b82f9204784c02f37e/NetRevisionTask/build/Unclassified.NetRevisionTask.targets#L53

AndreasAmMueller avatar Dec 28 '23 22:12 AndreasAmMueller

Seems to be new in .NET 8.0 linked to the SourceLink features...

.NET 8.0 - What's new: https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-8#source-link

Workaround/Fix found here: dotnet/sdk#34568 (comment)

tl;dr: Add following in a <PropertyGroup/> within your directory.build.props or .csproj file.

<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>

You could add this line below here:

https://github.com/ygoe/NetRevisionTask/blob/0657dc838261b1ec3b4a00b82f9204784c02f37e/NetRevisionTask/build/Unclassified.NetRevisionTask.targets#L53

This change: <IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion> to the app's project settings resolves this issue for me.

Thank you very much!

mattheweshleman avatar Jan 01 '24 15:01 mattheweshleman