Junior Mayhe
Junior Mayhe

Reputation: 16411

Does Hudson have a problem for building a CSPROJ file with MSBUILD?

Good morning

I'm running Hudson java -jar hudson.war and I have configured MSBuild as described here. It seems MSBuild is not working.

I think there is something to do with the default value contained in .csproj file:

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

This path is misleading, and takes Hudson to C:\Microsoft.CSharp.targets and not to C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.CSharp.targets as it should be.

I tried to hard code the csproj file, with this full path information, but it throws an exception too telling there is an invalid character.

Maybe I'm using the wrong MSBuild.exe version?

Here is the Hudson message when using default $(MSBuildToolsPath) variable in csproj:


Console Output

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

Upvotes: 2

Views: 923

Answers (2)

Peter Bernier
Peter Bernier

Reputation: 8078

You can also see the answer at the link below for another solution.

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

Upvotes: 0

Junior Mayhe
Junior Mayhe

Reputation: 16411

Ok, indeed I just needed to add the right path to

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

Upvotes: 5

Related Questions