Hudson是否有使用MSBUILD构建CSPROJ文件的问题?

时间:2010-11-24 12:16:17

标签: msbuild continuous-integration hudson

早上好

我正在运行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

2 个答案:

答案 0 :(得分:6)

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

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

答案 1 :(得分:0)

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

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