CraftyFella
CraftyFella

Reputation: 7568

Error doing an MSBuild on a CLR Storedprocedure project on Build Server

When building a CLR Storedprocedure Project using MSBuild on our build server (Team City) we're getting the following error:

error MSB4019: The imported project "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\SqlServer.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk

I've checked to see if the file exists on disk and sure enough it doesn't. I've checked on my own machine and it does exist.

I don't really want to start copying over files manually to the build server.

Here's the line from the csproj file which is being imported to the proj file:

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

Here's the line from the proj file which is being run by our Team City Server:

<Import Project="..\$(ProjectName).csproj"/>

My question is really:

Where does this file comes from? Is it part of the Visual Studio install for example.. Or is there some re-distribution package somewhere to allow me to compile this project on our build server?

Thanks

BTW.. if i just copy the file onto the Build server it does actually work.

Dave

Upvotes: 5

Views: 2045

Answers (2)

JotaBe
JotaBe

Reputation: 39055

Up to Visual Studio 2012, the SqlServer.targets was deployed on the .NET Framework's msbuild.exe location, like

  • c:\Windows\Microsoft.NET\Framework\v4.0.30319\
  • c:\Windows\Microsoft.NET\Framework\v3.5\
  • c:\Windows\Microsoft.NET\Framework\v2.0\

In modern versions, from Visual Studio 2013 on, the MSBuild tool is included with Visual Studio, and the MSBuild.exe and .targets files are deployed in their own folder. For example fo Visual Studio 2013:

  • c:\Program Files (x86)\MSBuild\12.0\Bin\

(NOTE: 12.0 is the "internal" version number of VS2013)

IMPORTANT NOTE: SqlServer.targets only exists if you install SQL Server Data Tools in your Visual Studio Deployment.

Upvotes: 0

jkhines
jkhines

Reputation: 1139

Looks like it's part of the v2.0 framework install that gets moved into the v3.5 directory after that's added. You can either reinstall v2.0 of the framework or manually copy the file out of the v3.5 folder.

Upvotes: 2

Related Questions