【问题标题】:Does Hudson have a problem for building a CSPROJ file with MSBUILD?Hudson 使用 MSBUILD 构建 CSPROJ 文件有问题吗?
【发布时间】:2011-05-15 01:52:03
【问题描述】:

早安

我正在运行 Hudson java -jar hudson.war,并将 MSBuild 配置为 described here。似乎 MSBuild 不起作用。

我认为这与 .csproj 文件中包含的默认值有关:

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

这条路径具有误导性,会将 Hudson 带到 C:\Microsoft.CSharp.targets,而不是应有的 C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.CSharp.targets

我尝试使用此完整路径信息对 csproj 文件进行硬编码,但它也会引发异常,告知存在无效字符。

也许我使用了错误的 MSBuild.exe 版本?

这是在 csproj 中使用默认 $(MSBuildToolsPath) 变量时的 Hudson 消息:


控制台输出

Started by user anonymous
Updating http://svn.mycoolserver.org/svn/repository/projects/trunk/MyCoolClassLibrary
U         MyCoolClassLibrary.csproj

At revision 36706
Path To MSBuild.exe: C:\Windows\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe
Executing command: cmd.exe /C C:\Windows\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe /p:Configuration=Release MyCoolClassLibrary.csproj && exit %%ERRORLEVEL%%
[workspace] $ cmd.exe /C C:\Windows\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe /p:Configuration=Release MyCoolClassLibrary.csproj && exit %%ERRORLEVEL%%

Microsoft (R) Build Engine Version 2.0.50727.3053
[Microsoft .NET Framework, Version 2.0.50727.3615]
Copyright (C) Microsoft Corporation 2005. All rights reserved.

C:\Documents and Settings\myUser\.hudson\jobs\MyCoolClassLibrary\workspace\MyCoolClassLibrary.csproj(63,11): error MSB4019: The imported project "C:\Microsoft.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
Finished: FAILURE

【问题讨论】:

    标签: msbuild continuous-integration hudson


    【解决方案1】:

    好的,确实我只需要添加正确的路径

    C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe
    

    【讨论】:

      【解决方案2】:

      您还可以在下面的链接中查看答案以获得其他解决方案。

      The imported project "C:\Microsoft.CSharp.targets" was not found

      【讨论】: