Reputation: 7754
So I am getting the error:
The imported project "C:\Microsoft.CSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
When I run this command:
%WINDIR%\Microsoft.NET\Framework\v2.0.50727\msbuild.exe MyProject.csproj /target:publish
I found others stating that I should change the following in my project file:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
To this:
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
I have already tried this and am still getting the same error. It seems as if both reserved properties are empty or set to "C:" does any one have any suggestions?
Upvotes: 0
Views: 3804
Reputation: 1214
Errors you're receiving might indicate .NET framework installation issues.
Create simple MSBuild file which will show you if that's the case:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="PrintInfo">
<Message Text="MSBuild tools path is:$(MSBuildToolsPath)" />
</Target>
</Project>
Upvotes: 2