Visual Studio build problem with “ReflectionOnlyAssemblyResolve event”

风流意气都作罢 提交于 2019-12-22 03:45:02

问题


I have a Visual Studio 2010 project that is targeted to .NET Framework 3.5. The project builds fine from Visual Studio, but when I try to compile it from the command line or from TeamCity I get the following build error:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFX.targets(269,9): error MC1000: Unknown build error, 'Cannot resolve dependency to assembly 'Microsoft.Windows.Design.Extensibility, Version=4.0.0.0, Culture=neutral, PublicKey Token=b03f5f7f11d50a3a' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.' [C:\Work\MyProject\MyProject.sln]

The linker seems to complain about Microsoft.Windows.Design.Extensibility.dll, but the project does not depend on this library.


回答1:


It is bombing trying to compile the XAML in the project. Ignore the remark about ReflectionOnlyAssemblyResolve event in the message, that's just it trying to be helpful to solve the problem. The real issue is that it simply cannot find the assembly.

That's to be expected, Microsoft.Windows.Design.Extensibility is a Visual Studio assembly, stored in the Common7\IDE\PublicAssemblies folder. It could only be found if that folder is in the probing path, it surely won't be if you run msbuild.exe from a build tool.

Not sure what to recommend, you'll have to find out where that dependency comes from. That probably ought to start at the .xaml file content, search for the assembly name. Also verify that the problem reproduces when you run msbuild.exe from the Visual Studio Command Prompt.



来源:https://stackoverflow.com/questions/3405053/visual-studio-build-problem-with-reflectiononlyassemblyresolve-event

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!