dotnet / Nerdbank.GitVersioning

Stamp your assemblies, packages and more with a unique version generated from a single, simple version.json file and include git commit IDs for non-official builds.
https://www.nuget.org/packages/Nerdbank.GitVersioning
MIT License
1.32k stars 165 forks source link

Is there a way to configure to not create AssemblyFileVersionAttribute #1025

Closed neilsilver closed 5 months ago

neilsilver commented 5 months ago

Im trying to apply to a .net framework 3.5 project and all works well.

However the nuget Generates an AssemblyFileVersionAttribute which is not supported in .net 3.5.

Ive searched the issues and docs but i can find a way to configure to not create this ?

[assembly: System.Reflection.AssemblyVersionAttribute("0.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("0.0.1.0")]

AArnott commented 5 months ago

AssemblyFileVersionAttribute which is not supported in .net 3.5.

There must be some mistake. That attribute has been supported since .NET Framework 1.0, as documented here: https://apisof.net/catalog/8450123a-1629-71ba-af60-76e63189fe24

Can you share a repro project and the actual error message?

neilsilver commented 5 months ago

Thanks @AArnott it might .. of course be related to the sandboxed environment im working in.

image

In my assembly Explorer its not there but in for example 4.7.2. it is.

AArnott commented 5 months ago

Are you perhaps targeting the .NET Micro or Compact Framework instead of .NET Framework? What is the file path to the assembly that is missing this attribute? If it's actually a standard .NET Framework path, I suspect corruption of some kind.

Anyway, you can workaround it by turning the assembly version file generation off. There's an msbuild property to do that: set GenerateAssemblyVersionInfo to false. That will disable all version stamping of your .NET assembly however, so you'll have to do your own version stamping, which a bunch of msbuild properties can help you with.

neilsilver commented 5 months ago

Yes the targeting is CF my bad !

Ill look into your workaround many thanks.