Derik Whittaker



Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at
NAnt/MSbuild build error MSB4019 -- Missing Targets

I was trying to setup our new build server today and received this error:

error MSB4019: the imported project <Path to .net framework here>\Microsoft.CompactFramework.CSharp.targets was not found.

At first I was a bit confused as to what was going one, how could you not find my targets file?  And of course this was working just fine on my laptop (always works on you machine), but not the build server.

Before I dive into the solution for this, I would like to pause to review what was on the build box.

Environment Overview:

Build Server: Team City
Build Script: NAnt
Build Action: MSBuild
Software Installed: .Net 2.0 SDK, .Net 3.5 SDK, .Net 3.5 Compact Framework SDK, need tools for build.  NO Visual Studio IDE's

Onto the Solution:

Ok, now that we know what the server setup was like, lets get onto the solution.

For what ever reason my build server did not contain any .targets files for the compact framework.    These files are normally found in your c:\Windows\Microsoft.Net\Framework\v3.5 folder, but mine were missing.  The easiest way to fix this issue is to grab these files off of the server/laptop that has them and copy/paste them onto the server that does not.  This worked just fine for me.

Note: My issue was with missing targets for the compact framework, but have heard reports of the same thing happening with other .targets files. 

Hope this helps someone.

Till next time,

Posted 09-19-2008 7:19 AM by Derik Whittaker
Filed under: ,



Nick wrote re: NAnt/MSbuild build error MSB4019 -- Missing Targets
on 09-19-2008 11:12 AM

No offense buddy... but ummm... the error was "targets not found in this directory" and the solution was to copy the targets to that directory.

Not exactly a stumper.

Derik Whittaker wrote re: NAnt/MSbuild build error MSB4019 -- Missing Targets
on 09-19-2008 11:19 AM


Agreed, in hindsight it was not hard.

But in the heat of the moment you do not think straight some times.

Dan Sniderman wrote re: NAnt/MSbuild build error MSB4019 -- Missing Targets
on 09-19-2008 3:18 PM

I've usually just bit the bullet and installed Visual Studio on the build machine.   I know there are potential licensing issues - but it was for a TFS installation - and I'm pretty sure I read SOMEWHERE that it was legit to do so (I should probably double check that sometime..)

Khaja Minhajuddin wrote re: NAnt/MSbuild build error MSB4019 -- Missing Targets
on 10-02-2009 7:09 AM

I had the same problem with the web application targets. This solution fixed it. But, this never came to my mind. A simple file copy to fix some stuff.

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Google Reader or Homepage Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of
Red-Gate Tools For SQL and .NET


SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
NHibernate Profiler
Balsamiq Mockups
JetBrains - ReSharper
Web Sequence Diagrams
Ducksboard<-- NEW Friend!


Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers


Community Server (Commercial Edition)