Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio build problem with "ReflectionOnlyAssemblyResolve event"

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.

like image 279
Amine Kerkeni Avatar asked Aug 04 '10 11:08

Amine Kerkeni


1 Answers

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.

like image 156
Hans Passant Avatar answered Nov 15 '22 21:11

Hans Passant