-
Notifications
You must be signed in to change notification settings - Fork 653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: .NET 8.0 - MSB4062 The "WriteVersionInfoToBuildLog" task could not be loaded - reloaded #4116
Comments
I'm guessing you're using VS due to the Apparently the GitVersion team dropped support for Visual Studio entirely, regardless of the target framework being used. 😕 Or at least that's the way I understand the replies... |
@Szaamaan , you're seeing that header because that's the CLI I've used to output local versions of msbuild, sdk, ecc.. But yes, I'm using VS2022., but I'm not trying to use GitVersion with anything .NET Framework related, I'm all on .NET 8. |
Yes, I know. But despite this, apparently, something doesn't work quite the same way with Visual Studio's On that note - do you get the same results if you run |
I've just tried building with
Reverting to Maybe it's me, but I'm staying on |
I have the same issue. MSBuild task won't generate static GitVersionInformation class. I can't compile any of my projects after upgrading from |
Same issue here. 6.0.0 and 6.0.1 are both faulty. |
@ashleyjlive any chance you could retry it with 6.0.2, just to keep this issue relevant? |
@sanghel-orbyta I've got the same issue with VS 2022 and .NET 8.0 and version 6.0.2 didn't resolve this for me. |
If an issue is closed and there is a comment similar to #4157 (comment), only in that case the issue is considered fixed, or if we explicitly mention. At this moment VS is not supported because of the reasons mentioned #4130. Hopefully we will have the time to find a solution, but at this point if you need to use the MsBuild package together with Visual Studio I would recommend to stick to version 5.12.0 for now |
Tested with 6.0.2 -> Still an issue. I have the same error but for My error is: GitVersion.MsBuild.targets(105,9): error MSB4062: The "GenerateGitVersionInformation" task could not be loaded from the assembly
C:\Users\REDACTED\.nuget\packages\gitversion.msbuild\6.0.2\tools\net8.0\GitVersion.MsBuild.dll.
Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct,
that the assembly and all its dependencies are available,
and that the task contains a public class that implements Microsoft.Build.Framework.ITask. Many things inside |
@ashleyjlive - I was able to work around that by adding to the csproj:
I have it (I think) working a project but not another. See also: #4130 |
Wow ... I misunderstood the "not supported" as "we do not have the time". But alas it has actually explicitly been removed (my bad). This is from the props file:
I now see it in the breaking changes (good). Missed it before. :-( @arturcic - Perhaps the GitVersion site (https://gitversion.net/docs/usage/msbuild) should mention GitVersion.MSBuild's Visual Studio retirement . Could save a lot of time. I think there is a big difference between a bug that may take a while to fix and a retirement of support for Visual Studio. Is there any point looking into it if the team does not plan to support VS? |
BTW - .NET Framework support is not actually required to work in VS. As a minimum it needs to support .NET Standard 2.0 and that was removed in 6.0.0. |
@arturcic - had a bit more of a look and I think the .NET Standard 2.0 support, and hence Visual Studio support, was dropped in a commit Jan 9, 2023 (merged Feb 18, 2023). There is another possibly related commit Nov 6, 2023. I think, these are your commits. Can you tell me if loss of VS support was a side affect here or intentional? It looks like it may be a clean-up moving stuff to the root folder. Commits: Thanks |
@RobSmyth the idea was we wanted to start using the new APIs in the newer versions of .NET and targeting netstandard put too much maintenance on us. Same for the .net framework. Then we saw it was broken in VS and we had to decide to either spend time on building new features, take advantage of new APIs, or be stuck on netstandard. At this point netstandard was needed mainly for GitVersion.MsBuild package which is not the most used package we publish, it's like 5% of the usage and was like 60% or so of the effort. That still does not mean we will not get back to this issue at some point, but that will take time, and it will require a different approach |
Thanks @arturcic - Shame but I understand. Blocker for me as I've always seen the dotnet tool approach as a workaround and would rather see MSBuild do it. Also kills a project I was about to release GitVersion.Afterburner!! :-) That clarifies it so i'll do something else. But ... I do think it would be good to update both the breaking changes and also the site. Not supporting .NET 4.8 does not read as "Dropped VS support". It will save a lot of angst making it clear. Thanks :-) |
Hi everyone, I have just come across GitVersion as we are planning to use this with our company projects. obj\Debug\Debug\net8.0\GitVersionInformation.g.cs(28,1): error CS1022: Type or namespace definition, or end-of-file expected The file GitVersionInformation.g.cs seems to only get generated if you set UseProjectNamespaceForGitVersionInformation to true. Inside GitVersionInformation.g.cs , I think GitVersion is trying to inject the "RootNameSpace" or if not, it will inject the project name. The compile/build error I traced back to a potential bug in the class: internal sealed class GitVersionInfoGenerator(IFileSystem fileSystem) : IGitVersionInfoGenerator in Modules.GitVersion.Output.GitVersionInfo The line of code that seems to be causing the issue is commented below: string getTargetNamespace(string extension) => extension switch there seems to be an extra semi colon here: ....... namespace {context.TargetNamespace};" : "" This I think caused the GitVersionInformation.g.cs to be created like : namespace MyChosenRootNS; If that extra semcolon is removed from that class, it should result in the namespace to be injected without ";". And donet build works fine in creating the GitVersionInformation.g.cs file I am not really sure, but just a hunch, and hope this helped out. Regards, |
@tammha if you want please submit a PR with the fix |
I'm keen on this functionality being returned. It's great to output the |
Prerequisites
GitVersion package
GitVersion.MsBuild
GitVersion version
6.0.0
Operating system
Windows
What are you seeing?
I'm seeing the error:
#3787 and #3704 suggest that after the betas, version
6.0.0
should work with .NET 8.After the above error is triggered, even reverting to
5.12.0
yields:which weirdly tries to use
net48
, even though I'm not on the .NET Framework anywhere in my solution.When the error is triggered, the only way to recover (remaining on
5.12.0
) is to close and re-open solution (I'm not sure but it seems the error leaves a dotnet.exe process.. )What is expected?
Task works as with version 5.12.0
Steps to Reproduce
With:
My csproj has:
RepositoryFixture Test
No response
Output log or link to your CI build (if appropriate).
No response
The text was updated successfully, but these errors were encountered: