What causes a "Cannot resolve dependency error" from MsBuild?

11,267

I hope you solved the problem, but for future reference:

I just had the same problem, and it comes from DevExpress '.design' assemblies. You're actually not supposed to reference those in your project. Remove all references to DevExpress assemblies ending with '.design' and it should work.

Share:
11,267

Related videos on Youtube

Bevan
Author by

Bevan

Professional software developer in Wellington, New Zealand.

Updated on May 28, 2022

Comments

  • Bevan
    Bevan almost 2 years

    I'm trying to set up some build scripts for continuous integration and I'm finding something weird.

    My solution compiles fine from Visual Studio 2010, but fails with an error when I build the exact same thing from the command line with MSBuild.

    Here's the error I get from the commandline build.

    C:\Windows\Microsoft.NET\Framework64\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, PublicKeyToken=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:\Dev\Market Watch\src\Console\MarketWatch.Console\Rbnz.MarketWatch.Console.csproj]

    I've checked through all my source code for references to Microsoft.Windows.Design.Extensibility and haven't found any at all. I've also checked all the binaries we reference from this project, including some DevExpress libraries.

    My MSBuild commandline looks like this:

    MsBuild.exe c:\Dev\MarketWatch\src\Capture\Capture.sln 
      /t:rebuild 
      /verbosity:quiet 
      /filelogger 
      /fileloggerparameters:LogFile=c:\Dev\MarketWatch\build\Logs\capture.msbuild.log
    

    Is there something missing that I should include on the MsBuild commandline to make commandline builds work just the same as those run by Visual Studio?

    Update 14/4

    • I'm getting these errors despite running the build script from a Visual Studio command prompt.
  • Bevan
    Bevan about 13 years
    Good suggestion, but I'm already running my build script from a VS2010 command prompt. I'll update the question to indicate this.
  • Bevan
    Bevan about 13 years
    I found a couple of links that talk about (mis)use of reflection - but they're all about code written wrong. My problem isn't ocurring at runtime, but at compile time.
  • Ed Noepel
    Ed Noepel almost 12 years
    The same applies to Mindscape.*.Design assemblies; thank you for saving me a lot of trouble.
  • tourdownunder
    tourdownunder over 10 years
    This was my problem after using Install-Package Microsoft.Expression.Blend.SDK.WPF Deleting the .design assemblies did the trick. Thanks.
  • Admin
    Admin over 10 years
    The same appears to apply to Infragistics .design assemblies.
  • Kranach
    Kranach almost 10 years
    Uh, thank god there is nothing maven-like in C# so ppl can waste endless hours on issues like that... thanks for saving us this time man!
  • Gabriel Vonlanten C. Lopes
    Gabriel Vonlanten C. Lopes almost 10 years
    This can solve the compilation issue but by doing this you will not be able to use the designer functionalities of the source code you tried to compile. I solved the issue by installing the Visual Studio SDK on the machine of the compilation and it worked fine.