2
votes

I am facing a assembly-not-found build problem on Win10 x64, using msbuild command line utility v14, targeting x86:

msbuild dummy.csproj /t:Rebuild /p:Configuration=Release;AppxBundle=Always;Platform=x86

The strange thing, is that, it seems to fail only on Win10 x64, not also on Win10 x86. I do not exclude although configuration differences.

And the error is:

Extracting .ResW files from assembly "C:\Users\abart.nuget\packages\Microsoft.CSharp\4.0.0\lib\netcore50\Microsoft.CSharp.dll" into "obj\x86\Release\".

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1047,5): error MSB3816: Loading assembly "C:\Users\abart.nuget\packages\Microsoft.NETCore.Portable.Compatibility\1.0.0\runtimes\aot\lib\netcore50\mscorlib.dll" failed. System.IO.FileNotFoundException: Could not load file or assembly 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. [dummy.csproj]

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1047,5): error MSB3816: File name: 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' [dummy.csproj]

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1047,5): error MSB3816: at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) [dummy.csproj] ....

The mscorlib.dll file does exist.

Any ideas why is this happening?

2
The problem was related to my csproj files.Adam Bartha
How did you solve the problem? I have the same symptoms. Please provide an answer and mark it as a solution so it may help me and others with the same problem.A. Nilsson

2 Answers

0
votes

You might need to use the full path for the x64 msbuild like below:

"c:\Program File(x86)\MSBUILD\14.0\bin\amd64\msbuild.exe"
0
votes

I can't confirm this is the answer for above, but I had/have very similar build problem for my Windows universal app.

Internal compiler error: MCG0024:UnresolvableTypeReference Unresolvable type reference 'System.ICloneable' in 'Assembly(Name=System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)' found. Please check the references in your build system. A reference is either missing or an assembly is missing an expected type.

The problem seems to crop up after some Visual Studio update or perhaps a Nuget update. I found the link referenced below and experimented by changing the property build settings for the problematic project and disabling the compile with.net native toolchain parameter.

I don't think this is the intended behavior or the long-term solution but it did get me back to being able to build and test code.

If someone else has an idea about how or why this problem is happening in the correct way to fix it in the long term please post back here. And thanks.

Dave G

http://www.lhotka.net/weblog/UWPCoreAssemblyName.aspx