← All articles

Visual Studio Project MSBuild Import Error Fix

Getting a 'Microsoft.CSharp.targets was not found' error in Visual Studio? Swap $(MSBuildToolsPath) for $(MSBuildBinPath) in your project file.

Donn Felker

Donn Felker

2008.10.20 · 1 min read

If you get this error:

Unable to read the project File <path.to.project>.csproj.

C:\\\\Project.csproj 77, 11): 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.

As shown in this screen shot …

image

Take a look at your project file. Open it in a text editor (such as NotePad++) and look for the import statement.

Mine looked like this:

clip_image001

How to fix

Change the MSBuild Property $(MSBuildToolsPath) to $(MSBuildBinPath) and the project should load.

Like so:

clip_image001[7]

Donn Felker

Written by Donn Felker

I've spent 25+ years shipping software, writing books, and running my own companies. I write about thinking clearly, working for yourself, and doing real work while AI rewrites the rules. New essays land here every week.

Get the newsletter

Keep reading