Silverlight 项目在 VS2008 中构建,但在使用 MSBuild 时失败 [英] Silverlight project builds in VS2008 but fails when using MSBuild

查看:54
本文介绍了Silverlight 项目在 VS2008 中构建,但在使用 MSBuild 时失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在同一个解决方案中有 2 个 Silverlight 项目;SLGlobalResource 和 SLData.SLData 引用 SLGlobalResource(使用引用 > 添加引用 > 项目).

We have 2 Silverlight projects in the same solution; SLGlobalResource and SLData. SLData references SLGlobalResource (using references > add reference > projects).

当我们在 VS2008 的调试中构建它时,一切都构建得很好,一切都很好.

When we build it in debug within VS2008, everything builds fine and all is good.

但是当我们使用:

msbuild TheSolution.sln /p:Configuration=Debug /t:rebuild

SLData 失败并出现以下错误:

SLData fails with the following error:

ViewModels\ImportViewModel.cs : error CS0246: The type of name space "SLGlobalResource" could not be found (are you missing a using directive or an assembly reference?)

这也发生在 TeamCity 中(我猜是因为 TeamCity vs2008 runner 使用 MSBuild)

This also happens in TeamCity (I guess because the TeamCity vs2008 runner uses MSBuild)

有什么想法吗?

谢谢

解决方案中实际上总共有 33 个项目.我以前不认为这是相关的,但现在我认为它可能是 - 这可能是构建订单的事情吗?

There are actually 33 projects in total in the solution. I didn't think this was relevant before but now I'm thinking it could be - could this be a build order thing?

编辑 2:

我发现,如果我使用 '/t:build' 参数而不是 '/t:rebuild' 参数,那么使用 msbuild 构建会成功,这几乎证实了它是一个构建顺序.我试过指定正确的配置(调试)和平台(x86),并确保所有引用都是项目引用,但仍然没有运气.我想我必须编写一个构建脚本来以正确的顺序显式构建这些并使用它,除非有人有更好的想法?

I found that building with msbuild would succeed if I use the '/t:build' parameter instead of '/t:rebuild' which pretty much confirms it's a build order thing. I've tried specifying the correct configuration (debug) and platform (x86) and also made sure the all the references are project references and still no luck. I guess I'll have to write a build script to explicitly build these in the correct order and use that unless any one has any better ideas?

干杯

推荐答案

在某些情况下,MSBuild 可以以意外的顺序构建事物.

In some cases MSBuild can build things in an unexpected order.

我遇到了这个问题,发现以下知识库文章很有帮助:

I ran into this problem and found the following KB article helpful:

http://support.microsoft.com/kb/964125/EN-US

这篇关于Silverlight 项目在 VS2008 中构建,但在使用 MSBuild 时失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆