-
Notifications
You must be signed in to change notification settings - Fork 654
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
the combination of VS 2019 Version 16.5.0 Preview 2.0 and .NET Core 3.1.200-preview-014883 fails dotnet build #2063
Comments
I can confirm that. I have the same issue now... |
@barrett777 Thanks for the link to the workaround :) |
I experience the same issue with the released 3.1.200 and GitVersionTask 5.2.4. All our CI builds fail now.
|
I noticed that as well. I'll need to find a fix for this |
Neither pinning to 3.1.101 with global.json nor a downgrade of GitVersionTask to 5.1.2 does help 😕 |
Have you upgraded the sdk on the CI to 3.1.200? |
Yes, I have updated the VS Build Tools to 16.5 on our build machine an hour ago. Our CI Build includes a build step to use .NET Core SDK 3.1.x, so it already used the latest SDK before my update 🙄 |
Then either you downgrade the build tools to 16.4 and used sdk 3.1.102 or just wait for a fix, but it could take some time to fix it. |
I've uninstalled 16.5 and installed 16.4.5 (for reference, you can get specific versions here). However, this didn't help, as each build agent has its own copy of dotnet + SDK, therefore I had to remove |
That's great |
This is likely a result of MSBuild changes to improve task isolation (dotnet/msbuild#4916). However, it looks like GitVersion has its own GitLoaderContext, which should have insulated you from that change. If you're affected by this, can you try setting the environment variable |
@rainersigwald setting Is there a way we can enable this without setting this env variable? I'd prefer someone using the package not to set the env variable prior to build |
@arturcic this may be a possible fix; |
thanks for pointing out, I'll check if it can be applied for us as well |
The SpecFlow fix doesn't seem to be relevant to GitVersion. I've been debugging it but haven't figured out what's up yet. I was able to break past the first problem but immediately found other problems. The reason this is happening is that the tasks don't do work themselves, but load an implementation via reflection and invoke that. When the default AssemblyLoadContext isn't configured to find task assemblies, this fails to load. Is there someone that can walk me through the intention of this code? |
@rainersigwald the implementation was somehow inspired from https://github.com/dotnet/sourcelink/blob/01e9ee3b6488c21e8c331d6f918bda5acf09d99f/src/Microsoft.Build.Tasks.Git/TaskImplementation.cs |
Notes on what I've figured out so far. I don't see a super clear path forward at the moment, will continue to look on Monday:
at var type = LibGit2SharpLoader.Instance.Assembly.GetType("GitVersion.MSBuildTask.GitVersionTasks", throwOnError: true).GetTypeInfo(); If you amend the private ALC to also load GetVersion = GetMethod<GetVersion>(type, nameof(GetVersion));
...
private static Func<T, bool> GetMethod<T>(TypeInfo type, string name) => (Func<T, bool>)type.GetDeclaredMethod(name).CreateDelegate(typeof(Func<T, bool>)); fails, because the
In the old MSBuild, there was no task ALC, only the default ALC. That meant that
|
I think #2221 should do the trick. Comments welcome. |
Is it possible to ilmerge all dependent assemblies and avoid assembly load context? |
🎉 This issue has been resolved in version 5.3.0 🎉 Your GitReleaseManager bot 📦🚀 |
Thanks guys, you're awesome! |
great! |
Can confirm that it's fixed 👍 |
Update GitVersionTask to 5.3.7 because of issue with dotnet build GitTools/GitVersion#2063
I'm referencing the Nuget package version 5.3.7 and this issue still remains on my side. Building with Visual Studio works but building with C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: Échec inattendu de la tâche "WriteVersionInfoToBuildLog". [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: System.TypeInitializationException: The type initializer for 'GitVersionTask.MsBuild.TaskProxy' threw an exception. [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: ---> System.IO.FileNotFoundException: Could not load file or assembly 'GitVersionTask.MsBuild, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Le fichier spécifié est introuvable. [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: File name: 'GitVersionTask.MsBuild, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: ---> System.IO.FileNotFoundException: Could not load file or assembly 'GitVersionTask.MsBuild, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Le fichier spécifié est introuvable. [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: File name: 'GitVersionTask.MsBuild, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly) [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext) [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName) [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: at GitVersionTask.MsBuild.LibGit2Sharp.GitLoaderContext.Load(AssemblyName assemblyName) in D:\a\1\s\src\GitVersionTask.MsBuild\LibGit2Sharp\GitLoaderContext.cs:line 30 [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName) [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName) [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: at System.Reflection.RuntimeAssembly.GetType(QCallAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive, ObjectHandleOnStack assemblyLoadContext) [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: at System.Reflection.Assembly.GetType(String name, Boolean throwOnError) [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: at GitVersionTask.MsBuild.TaskProxy..cctor() in D:\a\1\s\src\GitVersionTask.MsBuild\TaskProxy.cs:line 22 [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: --- End of inner exception stack trace --- [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: at GitVersionTask.MsBuild.Tasks.WriteVersionInfoToBuildLog.Execute() in D:\a\1\s\src\GitVersionTask.MsBuild\Tasks\WriteVersionInfoToBuildLog.cs:line 5 [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\dev\Git\Project\src\Project\Project.csproj]
C:\Users\mevelje\.nuget\packages\gitversiontask\5.0.1\build\GitVersionTask.targets(10,9): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\dev\Git\Project\src\Project\Project.csproj] |
@jmevel You seem to be using GitVersionTask 5.0.1, not 5.3.7, check your log. |
Hum that's correct, thanks for pointing me this mistake! |
If you install VS 2019 Version 16.5.0 Preview 2.0 (Released 1/22/2020),
dotnet build
fails with this error. Here's a related StackOverflow question/answer on how to work around.https://stackoverflow.com/a/59876257/1603663
I don't know if this issue is a bug in .net core, or an update required in GitVersion
The text was updated successfully, but these errors were encountered: