使用 MSBuild 构建时缺少程序集引用,但在 VS 2008 中构建成功
我正在尝试为我们的项目创建 nAnt 构建脚本。 当我尝试通过 msbuild 构建它 - 从 nAnt 调用作为外部任务时,我得到了全部丢失引用错误。但当我尝试从 VS 2008 构建它时,一切正常。 我发现一个项目正在引用(通过 *.cs 文件中的“using”子句通过下面的命名空间)另一个 Web 项目。重点是,这个 WebProject 在 SLN 中称为 WebClient,但在它的属性中,它也是具有其他命名空间(如 Copmany.Something.dll)的输出程序集。我尝试通过从 VS 指向它来添加对它的引用,但 VS 不允许我这样做,因为这将是循环依赖。 也许有人有类似的问题?
I'm trying to create nAnt build scripts for our project.
When I try to build it via msbuild - called from nAnt as an external task, i got the whole loads of missing reference errors. But when I try to build it from the VS 2008 it's OK.
I've found one project which is referencing (by "using" clause in the *.cs file by an namespace below) to another webproject. The point is that this WebProject is called WebClient in SLN but in it's properities get's also the output assembly with other namespace like Copmany.Something.dll. I've tried to add reference to it by pointing it from VS but VS does not allow me to do that because it would be a circular dependency.
Maybe someone had a similar problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试从VS命令提示符调用MSBuild.exe一个>。命令行与VS的构建环境相同。要使其通过脚本或 CI 工作,您可以调用 C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat。
编辑:
您可以构建您的 sln 文件:
如果您可以确定 VS 构建 Sln 时没有错误,则可以在 nant 中设置相同的构建行为。
Try to call MSBuild.exe from VS command promt. Command line has the same biuld environment as VS. To make it work from the script or CI you can call C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat.
EDIT:
You can build your sln files:
If you can be sure that VS builds Sln without errors, you can set the same build behavouir in nant.
我遇到了类似的问题,但事实证明这是由针对 4.0 运行时的 NAnt 引起的。 Visual Studio 的目标是 3.5,所以我猜依赖关系的处理方式有所不同。我通过强制 NAnt 以 3.5 运行时为目标来修复它。
I had a similar problem, but it turned out to be caused by NAnt targeting the 4.0 runtime. Visual Studio was targeting 3.5, so the dependencies were handled differently, I guess. I fixed it by forcing NAnt to target the 3.5 runtime.