Friday 11 September 2009

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


If you've received this error, it usually means that the targets file can not be found/identified by the current versiuon of visual studio....

I usually receive this error when attempting to import a .NET 3.5 project into a .NET 2.0 solution.

To tackle this particular scenario, you will need to open the project file (.csproj).... and if you wish to make the project .NET 2.0 ready, you will need to find the following line (specific to 3.0/3.5)...


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

and replace with...

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

1 comment:

Unknown said...

Oh man, you saved me hours and hours of time. I kept getting the MSB4019 error, c:\Microsoft.VisualBasic.Tasks not found. I tried everything but nothing worked.

Your solution worked first time and fixed my build errors.

You da man!.
Peter