Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF compilation error on CI server: Microsoft.VisualStudio.ServiceModel.targets not found

Tags:

I am getting this error on my CI server:

error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\WCF\Microsoft.VisualStudio.ServiceModel.targets" was not found

It seems my WCF service library project references that file, but the VisualStudio folder on Program Files\MSBuild\Microsoft doesn't contain a WCF folder.

I guess I need to install something on the server.

What do I need to install?

like image 657
Orlando William Avatar asked Feb 01 '13 05:02

Orlando William


4 Answers

Well this ruined my morning, but let's not allow it to ruin anyone else's. I couldn't find this information anywhere else. You need to copy a few files from a development machine with VS Pro 2012.

As aphexddb mentions, you need to copy some targets from C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\WCF to the same location on your CI server.

This then references an assembly called Microsoft.VisualStudio.ServiceModel.Core. You can find this assembly in either the GAC or in the IDE directory at C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE.

Copy this to your CI server and execute gacutil.exe -i Microsoft.VisualStudio.ServiceModel.Core.dll

This was enough to fix it for me.

This isn't the first time I found targets missing from my VS express install in my CI server. I can't help but feel that there is some sort of package I can download from somewhere that fills all this in. Does anyone know of such a thing? If not, perhaps we should create one.

like image 77
Steve Rukuts Avatar answered Sep 22 '22 20:09

Steve Rukuts


Can still happen on vs2019

error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VisualStudio\v16.0\WCF\Microsoft.VisualStudio.ServiceModel.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

WCF is not installed by default as part of 'ASP.NET and web development' workload. To fix this,

On visual studio installer > modify > individual components tab, search for wcf, check, modify - the .targets file gets now installed, msbuild builds ok.

MSBuild auto-detection: using msbuild version '16.3.2.50909' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin'

like image 21
Edu M Avatar answered Sep 23 '22 20:09

Edu M


I ran into this with Visual Studio 2017, for me the resolution was to modify my installation of Visual Studio to include the Windows Communication Foundation components.

like image 7
JG in SD Avatar answered Sep 21 '22 20:09

JG in SD


Extract this file into folder

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\WCF

The file name is "Microsoft.VisualStudio.ServiceModel.targets"

like image 5
M_ Fa Avatar answered Sep 22 '22 20:09

M_ Fa