简体   繁体   English

Win10 msbuild:加载程序集失败

[英]Win10 msbuild: Loading assembly failed

I am facing a assembly-not-found build problem on Win10 x64, using msbuild command line utility v14, targeting x86: 我使用针对x86的msbuild命令行实用程序v14,在Win10 x64上遇到了程序集未找到的生成问题:

msbuild dummy.csproj /t:Rebuild /p:Configuration=Release;AppxBundle=Always;Platform=x86 msbuild dummy.csproj / t:重建/ p:配置=发布; AppxBundle =始终;平台= x86

The strange thing, is that, it seems to fail only on Win10 x64, not also on Win10 x86. 奇怪的是,它似乎仅在Win10 x64上失败,而不在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:\\ Users \\ abart.nuget \\ packages \\ Microsoft.CSharp \\ 4.0.0 \\ lib \\ netcore50 \\ Microsoft.CSharp.dll”中提取.ResW文件到“ 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. C:\\ Program Files(x86)\\ MSBuild \\ Microsoft \\ VisualStudio \\ v14.0 \\ AppxPackage \\ Microsoft.AppXPackage.Targets(1047,5):错误MSB3816:正在加载程序集“ C:\\ Users \\ abart.nuget \\ packages \\ Microsoft .NETCore.Portable.Compatibility \\ 1.0.0 \\ runtimes \\ aot \\ lib \\ netcore50 \\ mscorlib.dll”失败。 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. System.IO.FileNotFoundException:无法加载文件或程序集“ System.Private.CoreLib,版本= 4.0.0.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a”或其依赖项之一。 The system cannot find the file specified. 该系统找不到指定的文件。 [dummy.csproj] [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):错误MSB3816:文件名:'System.Private.CoreLib,Version = 4.0.0.0 ,文化=中性,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] .... C:\\ Program Files(x86)\\ MSBuild \\ Microsoft \\ VisualStudio \\ v14.0 \\ AppxPackage \\ Microsoft.AppXPackage.Targets(1047,5):错误MSB3816:位于System.ModuleHandle.ResolveType(RuntimeModule模块,Int32 typeToken,IntPtr * typeInstArgs,Int32 typeInstCount,IntPtr * methodInstArgs,Int32 methodInstCount,ObjectHandleOnStack类型)[dummy.csproj]...。

The mscorlib.dll file does exist. mscorlib.dll文件确实存在。

Any ideas why is this happening? 任何想法为什么会这样?

您可能需要使用x64 msbuild的完整路径,如下所示:

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

I can't confirm this is the answer for above, but I had/have very similar build problem for my Windows universal app. 我不能确定这是上面的答案,但是我的Windows通用应用程序存在/具有非常相似的构建问题。

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. 内部编译器错误:MCG0024:UnresolvableTypeReference在“ Assembly(Name = System.Private.CoreLib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a)”中找到了无法解析的类型引用“ System.ICloneable”。 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. 在某些Visual Studio更新或Nuget更新之后,似乎出现了该问题。 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. 我找到了下面引用的链接,并通过更改有问题的项目的属性构建设置并禁用了with.net本机工具链参数进行了实验。

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 戴夫G

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM