Closed wjrogers closed 5 years ago
same here.
Same problem without multitargeting, only netcoreapp22/netstandard20
Hey guys, had the same issue, but on version 4.0.0 (not the beta). The reason was I had just created a new project and added Gitversion without ever committing anything to the project. After I created my first commit the issue stopped happening.
Possibly not the same issue though.
Still no fix?
I have this problem on 4.0.0, but not on 4.0.0-beta0012
Can you guys give it a try to this version
As LibGit2Sharp was upgraded to version 0.26 in #1713, I think this problem is fixed. Please reopen this issue if the problem persists.
@arturcic The original bug is fixed, thanks. However, it seems like beta4 introduced a new issue: GitVersionTool generates multiple assembly version files.
In obj/Debug/<target framework>/ there are three(!) files with AssemblyFileVersion
generated. E.g. _AssemblyInfo_TinyLittleMvvmluhkzhpu.hpc.g.cs, _AssemblyInfo_TinyLittleMvvmvldmbkmg.upl.g.cs, and TinyLittleMvvm.AssemblyInfo.cs. The first two files contain only the attributes AssemblyFileVersion
, AssemblyVersion
, and AssemblyInformationalVersion
, and the last file contains all assembly level attributes.
This results in many error CS0579: Duplicate 'System.Reflection.AssemblyXxxAttribute' attribute
errors. E.g. see the output of my latest build.
Gave you followed these steps? https://gitversion.readthedocs.io/en/latest/usage/msbuild-task/, the Remove AssemblyInfo attributes
step I mean
I guess in your case it's an sdk project, then you should add this
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Thanks for the pointer. In the past it worked without that property. I'll try it tomorrow.
Well, the GenerateAssemblyInfo
indeed disables generating the AssemblyInfo. However, that file also includes all the assembly attributes, such as AssemblyProduct, AssemblyTitle, AssemblyCopyright and so forth.
The correct way is to set <UpdateAssemblyInfo>false</UpdateAssemblyInfo>
. In this case, GitVersion won't generate its own AssemblyInfo file, but set the necessary MSBuild properties, and the SDK build will write the correct values to its AssemblyInfo.
I'm still having this issue with my .net core 2.2 web project. i have tried the steps suggested but still getting the same error. Any other suggestions?
same issue on dot net core 3 project
Hey guys, had the same issue, but on version 4.0.0 (not the beta). The reason was I had just created a new project and added Gitversion without ever committing anything to the project. After I created my first commit the issue stopped happening.
Possibly not the same issue though.
This helped me a lot. In my case this was because I checked out a specific commit in git. I just created a new branch on this commit and the issue disappeared
For anyone coming from Google, this was near impossible for me to track down, but it turned out it was simply because all the source files in my project were LF instead of CRLF.
Which was the reason why it sometimes worked when doing different git things like git branching, git stashing, etc, but kept re-appearing randomly for some inexplicable reason
For others coming here because they searched the error message
The "GetAssemblyVersion" task was not given a value for the required parameter "NuGetVersion"
for me the problem was I was only specifying the Version
parameter in my build script, and needed to specify the AssemblyVersion
as well.
That is, I changed this:
dotnet build "$path" -p:Version=$versionNumber --configuration Release
Which would give the error, to this:
dotnet build "$path" -p:AssemblyVersion=$versionNumber -p:Version=$versionNumber --configuration Release
And that fixed it up for me.
My project is multi-targeting
net471
andnetcoreapp2.1
. The same error occurs when I build both targets and when I build either one individually.