"Microsoft.CSharp.targets" was not found
I'm trying to build a .net 3.5 project with TeamCity and NAnt 0.85 version of nant, but got the following error:
error MSB4019: The imported project "E:\Microsoft.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct
it seems the team city nant wants to target .net 2.0. The project is using 3.5 framework. Also, the .targets would not be in the E: drive. How would change this?
[16:01:11]: Target framework: Microsoft .NET Framework 2.0
[16:01:11]: Base Directory: E:\TeamCity\buildAgent\work\ba2117a951aab8a8.
[16:01:11]: Target(s) specified: compile
[16:01:11]: property
[16:01:11]: property
[16:01:11]: property
[16:01:11]: property
[16:01:11]: property
[16:01:11]: property
[16:01:11]: property
[16:01:11]: property
[16:01:11]: property
[16:01:11]: Build sequence for target `compile' is compile
[16:01:11]: Complete build sequence is compile, setup, move.assemblies.for.tests, tests.run
[16:01:11]: msbuild (3s)
[16:01:11]: [msbuild] Starting MSBuild...
[16:01:12]: [msbuild] Starting 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msbuild.exe (@"E:\TeamCity\buildAgent\work\ba2117a951aab8a8\build.csproj.teamcity.msbuild.tcargs")' in 'E:\TeamCity\buildAgent\work\ba2117a951aab8a8'
[16:01:13]: E:\TeamCity\buildAgent\work\ba2117a951aab8a8\build.csproj(65, 11): error MSB4019: The imported project "E:\Microsoft.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
[16:01:14]: E:\TeamCity\buildAgent\work\ba2117a951aab8a8\build.build(29,4): External Program Failed: msbuild (return code was 1)
[16:01:11]: Base Directory: E:\TeamCity\buildAgent\work\ba2117a951aab8a8.
[16:01:11]: Target(s) specified: compile
[16:01:11]: property
[16:01:11]: property
[16:01:11]: property
[16:01:11]: property
[16:01:11]: property
[16:01:11]: property
[16:01:11]: property
[16:01:11]: property
[16:01:11]: property
[16:01:11]: Build sequence for target `compile' is compile
[16:01:11]: Complete build sequence is compile, setup, move.assemblies.for.tests, tests.run
[16:01:11]: msbuild (3s)
[16:01:11]: [msbuild] Starting MSBuild...
[16:01:12]: [msbuild] Starting 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msbuild.exe (@"E:\TeamCity\buildAgent\work\ba2117a951aab8a8\build.csproj.teamcity.msbuild.tcargs")' in 'E:\TeamCity\buildAgent\work\ba2117a951aab8a8'
[16:01:13]: E:\TeamCity\buildAgent\work\ba2117a951aab8a8\build.csproj(65, 11): error MSB4019: The imported project "E:\Microsoft.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
[16:01:14]: E:\TeamCity\buildAgent\work\ba2117a951aab8a8\build.build(29,4): External Program Failed: msbuild (return code was 1)
Please sign in to leave a comment.
Could you please check you running NAnt under 32bits and boild agent is not running under SYSTEM account.
Please try running you build from commandline using msbuild.exe in the same folder and under the same user account as build agent does.
Thanks!
It is 32bit, but the agent is running under local system account.
Why would using system account matter?
I have already fixed the framework issue by adding <property name="teamcity_dotnet_use_msbuild_v35" value="true"/> to the NAnt's msbuild project.
Looks like adding the teamcity property to get framework 3.5 in the build file took care of it. It works now.
There were some builds that required running as local administrator.