views:

11830

answers:

4

I got this error today when trying to open a Visual Studio 2008 project in Visual Studio 2005:

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

So I thought I'd post it here in case anyone else is interested

+24  A: 

Open your csproj file in notepad (or notepad++) Find the line:

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

and change it to

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
lomaxx
Thanks for your answer!
John at CashCommons
Awesome, thanks for posting this!
Peter Bernier
+1  A: 

This link on MSDN also helps a lot to understand the reason why it doesn't work. $(MSBuildToolsPath) is the path to Microsoft.Build.Engine v3.5 (inserted automatically in a project file when you create in VS2008). If you try to build your project for .Net 2.0, be sure that you changed this path to $(MSBuildBinPath) which is the path to Microsoft.Build.Engine v2.0.

Oleg Sakharov
A: 

I get this when I try to build using the command line (vsbuild). Fixing the path does not work. I run VCVARS32.BAT first, then try the build. THe build works fine when I use VS2008 from the IDE.

Mark
A: 

ok so what if it say this: between the gt/lt signs

Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" /

how do i fix the targets error?

I also found that import string in a demo project (specifically "Build your own MVVM Framework" by Rob Eisenburg).

If you replace that import with the one suggested by lomaxx VS2010 RTM reports that you need to install this.

Andre Luus