-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context #141
Comments
Thanks for the detailed information! As I understand, now you have a completed installation:
However, could you please describe steps for how it was installed (net core 3.1 + MSBuild 16) ? Also, can you try to remove all or some of the problematic assemblies from Such:
Then try again. All this, on the contrary, was added due to other problems in past. |
@3F I tried removing the whole I installed visual studio using the usual installer, I'll export its configuration, you'll find it inside this zip file, then use vs installer import configuration feature. |
No, do not do this because it will be restored to initial state again! Try as I said in order as it was mentioned earlier. For the case when Clr will try to load assemblies from other available places for your environment (GAC etc). At least this might help to better understand the problem.
Thanks, I'll try to reproduce this for clean VM as possible for my time. |
Just checked netstandard2.1 + Ok for 16.5.1 on clean VM (Windows 10 image). Unfortunately I have no access to your 16.4.6 through latest official installer. But here is another interest to your environment. I noticed that you have only:
Actually it cannot be installed separately from related a .NET Core Runtime component that obviously strange. Even import feature of the .vsconfig will forcibly activate two. So how did you get this? More like you still have some incomplete or incorrectly installed instances such before Please try to fix your installed products and make sure you have installed both following components:
|
@3F I tried removing problematic assemblies as you suggested, it now reports
I now have them both installed and tried to remove the DllExport folder from packages folder as well as removing problematic assemblies like you suggested, still Build fails with the same errors. |
The error actually depends on your environment and I don't know how to reproduce your case because: As I know MS still provides compatible interface for tasks even for modern ways. This is relevant for Microsoft.Build.Framework.ITask (Microsoft.Build.Framework.dll) and Microsoft.Build.Utilities.AppDomainIsolatedTask (Microsoft.Build.Utilities.v4.0.dll). Therefore, your problem cannot be with incompatible or obsolete assemblies. I think. On the contrary, it can require something more that you don't have. But here is actual problem, as I said, all required components should be installed as for my clean VM. I strongly recommend to update to 16.5.1 because it can be problem with components and/or incorrect vs-installer. By the way, what OS? Please attach information using the following commands: msbuild [your.sln] /t:Rebuild /m:4 /v:diag > build.log tree /F C:\Windows\Microsoft.NET > netenv.txt You also can try (I don't think that problem with this but just to be sure): In tools\net.r_eg.DllExport.targets replace the 3rd line <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> Then try again. If not, try this: <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> Most important: Reload project/solution for your IDE after each changes; or build with msbuild. |
I tried both, still the same problem. |
@abnud1 Thanks for the new details! I'll try to inspect this of course, but to be sure, Is this the only project where this error appears? What about new or some others that are more trivial than 285K+ lines (22.4 MB) ? |
Please try as I already said above. You can use hmsbuild or locate it manually:
or for sure
|
I now know the problem, I'm not sure if this issue is resolved though, |
You must use msbuild tools today instead of dotnet cli.
Same for msbuild tools! Even officially they recommends to use exactly this instead of I close this issue. You can also open a new one for add support or discuss an alternative to |
How to reproduce:
When jumping to source it goes to here:
at file net.r_eg.DllExport.targets
-version: v1.7.0.60761+0a002a7
-build-info:
S_NUM: 1.7.0
S_REV: 60761
S_NUM_REV: 1.7.0.60761
S_REL:
bSha1: 0a002a7
bName: master
bRevc: 201
MetaCor: netstandard1.1
MetaLib: v2.0
Wizard: v4.0
Configuration: PublicRelease
Platform: Any CPU
cfgname: Release
revDeltaBase: 2016/10/12
revDeltaMin: 1000
revDeltaMax: 65534
The full command to Manager: ./DLLExport.bat
Project type: .Net standard project
Environment ( VS, MSBuild, ...): .Net core 3.1, IDE IS Rider 2019.3, not Visual Studio, MSBuild version is 16.
log:
DllExport.bat output
hMSBuild.bat -debug -only-path output
vswhere -requires Microsoft.Component.MSBuild -products * -latest output
The text was updated successfully, but these errors were encountered: