导致“无法解决依赖关系错误”的原因来自MsBuild?
我正在尝试设置一些构建脚本以进行持续集成,但我发现了一些奇怪的事情。
我的解决方案可以从 Visual Studio 2010 正常编译,但当我使用 MSBuild 从命令行构建完全相同的内容时,会失败并出现错误。
这是我从命令行构建中得到的错误。
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.WinFX.targets(269,9):
错误 MC1000:未知的构建错误,
“无法解析对程序集“Microsoft.Windows.Design.Extensibility,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”的依赖关系,因为它尚未预加载。使用 ReflectionOnly API 时,必须通过 ReflectionOnlyAssemblyResolve 事件预加载或按需加载依赖程序集。'
[C:\Dev\Market Watch\src\Console\MarketWatch.Console\Rbnz.MarketWatch.Console.csproj]
我已检查了所有源代码中对 Microsoft.Windows.Design.Extensibility
并且根本没有找到任何东西。我还检查了我们从该项目引用的所有二进制文件,包括一些 DevExpress 库。
我的 MSBuild 命令行如下所示:
MsBuild.exe c:\Dev\MarketWatch\src\Capture\Capture.sln
/t:rebuild
/verbosity:quiet
/filelogger
/fileloggerparameters:LogFile=c:\Dev\MarketWatch\build\Logs\capture.msbuild.log
是否缺少一些内容,我应该在 MsBuild 命令行中包含这些内容,以使命令行构建的工作方式与 Visual Studio 运行的构建方式相同?
更新 14/4
- 尽管从 Visual Studio 命令提示符运行构建脚本,我还是遇到了这些错误。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我希望你解决了这个问题,但为了将来的参考:
我刚刚遇到了同样的问题,它来自 DevExpress '.design' 程序集。实际上你不应该在你的项目中引用那些。删除对以“.design”结尾的 DevExpress 程序集的所有引用,它应该可以工作。
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.
遇到同样的问题,我正在寻找解决方案:
Microsoft.Xaml.Behaviors.Design.dll
和Microsoft.Xaml.Behaviors.DesignTools.dll
,然后将它们注释掉。就我而言,它们在.csproj
项目文件中被引用,如下所示:Hit the same problem, the solution for me was searching for:
Microsoft.Xaml.Behaviors.Design.dll
andMicrosoft.Xaml.Behaviors.DesignTools.dll
, then commenting them out. In my case, they were referenced in.csproj
project file as following:您应该初始化路径以查找程序集、工具等。在调用 msbuild 之前调用 vcvarsall.bat:
或者打开 VS2010 命令行控制台并从中调用脚本。两个动作具有相同的效果。
编辑:我无法理解一件事 - google 对于您的问题表示您以错误的方式使用反射,并且描述了一种可能的解决方案此处。我说得对吗?
You should initialize paths to find assemblies, tools and so on. Call vcvarsall.bat before calling msbuild:
Or open VS2010 command line console and call your script from it. Both actions has the same effect.
EDIT: I couldn't understand one thing - google for your question says that you use Reflection in a wrong way, and one of possible solutions is described here. Am I right?
我最近遇到了同样的问题。
该错误是在我们的 VSTS-BuildAgent 上引发的。
在遵循 Devexpress 站点(包括项目升级)的所有建议后,错误仍然存在。
老实说,我们将 WinForms 和 WPF 混合在一起,以便从 Winforms 顺利迁移到 WPF,所以基本上不是日常问题。
不管怎样,我能够通过再次添加所有需要的 WPF-Project 引用来解决这个问题,即使它们都已经在 Start-Project(即 Winforms)中引用了。
完成此操作后,BuildAgent 即可成功构建。
I recently encountered the same issue.
The Error was thrown on our VSTS-BuildAgent.
After following all advices from Devexpress sites (including Project-Upgrade), the Error was still there.
To be honest, we are mixing WinForms and WPF for a smooth migration from Winforms to WPF, so basically not an everyday-problem.
Anyway, i was able to fix this, by adding all needed references to WPF-Project again, even if they are all already referenced in the Start-Project, which is Winforms.
After this move, the BuildAgent was able to succeed the Build.