代码之家  ›  专栏  ›  技术社区  ›  Junior Mayhé

用msbuild生成csproj文件时,Hudson有问题吗?

  •  2
  • Junior Mayhé  · 技术社区  · 14 年前

    早上好

    我在运行哈德逊 java -jar hudson.war 我已经将msbuild配置为 described here . 似乎msbuild不起作用。

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

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

    这条路误导了哈德逊 C:\Microsoft.CSharp.targets 而不是为了 C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.CSharp.targets 应该是这样的。

    我试图用这个完整的路径信息对csproj文件进行硬编码,但它也抛出了一个异常,说明有一个无效字符。

    可能我使用了错误的msbuild.exe版本?

    以下是使用默认值时的哈德逊信息 $(MSBuildToolsPath) csproj中的变量:


    控制台输出

    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 回复  |  直到 13 年前
        1
  •  6
  •   Junior Mayhé    14 年前

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

    C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe
    
        2
  •  0
  •   Community CDub    8 年前

    您也可以在下面的链接中看到另一个解决方案的答案。

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