If you receive the following Visual Studio compiler error:

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.

Open the current Visual Studio project file (with the .csproj extension) in Notepad.  Find this line:

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

And replace it with this line:

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

Save the project file in Notepad.  When you return to Visual Studio, it will notify you that the project file has been modified outside of the environment.  Click the Reload button to reload the project file.  Compile your project again, and the error should be gone.

Share and Enjoy:
  • Digg
  • Twitter
  • Facebook
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Google Bookmarks
  • Slashdot