-
Notifications
You must be signed in to change notification settings - Fork 87
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
MSBuild evaluation fails with "System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1" not found #95
Comments
While we'd rather test *both*, microsoft/MSBuildLocator#95 is likely the cause for a failure of MSBuild to locate System.Collections.dll,v5.0 when running on the .NET Core 3.1 runtime but under the 5.0 SDK.
While we'd rather test *both*, microsoft/MSBuildLocator#95 is likely the cause for a failure of MSBuild to locate System.Collections.dll,v5.0 when running on the .NET Core 3.1 runtime but under the 5.0 SDK.
Same issue on my side. It's not pretty but adding an AppDomain.CurrentDomain.AssemblyResolve += (s, e) =>
{
var filePath = Path.Combine(latestInstance.MSBuildPath, $"{new AssemblyName(e.Name).Name}.dll");
if (File.Exists(filePath))
{
return Assembly.LoadFrom(filePath);
}
return null;
}; Please note that depending on the version of |
Was this fixed by #94? |
I think I tested the pre-release version that should have contained the fix and I still had issues. It might have been on different assembly though. Why do we keep a fixed list of MsBuild assemblies? Why don't we just load if it's found in the MsBuild directory? It seems more future-proof to me. |
A very reasonable question. I can imagine it would be worse for perf, since a lot of that stuff isn't really MSBuild's, but I doubt that would be a huge factor, and it would certainly be more convenient and future-proof. I put a change here. We'll see how it goes. 🙂 |
#107 was merged, though it isn't in the NuGet package yet. Does that work? |
@Forgind: No. I locally built master (d007e5e) and tested it against my original repro (https://github.com/dotnet/Nerdbank.GitVersioning.git 0f97225) and ran the
|
I think that error has now been fixed. |
Confirmed. As of 23fb66e the test passes now. |
My unit tests which use the MSBuildLocator started failing recently when MSBuild 16.7 came out with the failure below.
The Microsoft.Build.dll that is loaded by MSBuildLocator has
System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0
next to it. I don't have any version of that assembly in my test output directory. Shouldn't the MSBuildLocator's assembly resolver find all of the msbuild's dependencies including this one?The text was updated successfully, but these errors were encountered: