WCF compilation error on CI server: Microsoft.Visu

2019-03-23 07:55发布

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?

6条回答
forever°为你锁心
2楼-- · 2019-03-23 08:32

Ran into this same issue. Did the following to resolve:

  1. Installed the Microsoft Web Platform Installer

  2. Copied Directory "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\WCF" from dev laptop with Visual Studio 2012 to the build server

查看更多
老娘就宠你
3楼-- · 2019-03-23 08:34

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.

查看更多
相关推荐>>
4楼-- · 2019-03-23 08:41

I ran into this same error. In my case, the problem was that my Visual Studio 2008 project didn't get upgraded correctly, probably due to files being marked "read-only" by my source control. To fix it, I loaded the solution in Visual Studio 2015 with everything checked out.

The specific line in the .csproj file changed from

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\WCF\Microsoft.VisualStudio.ServiceModel.targets" />

To

<Import Project="$(WcfServiceModelTargetPath)\Microsoft.VisualStudio.ServiceModel.targets" />
查看更多
做自己的国王
5楼-- · 2019-03-23 08:54

Extract this file into folder

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

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

查看更多
Evening l夕情丶
6楼-- · 2019-03-23 08:55

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.

查看更多
【Aperson】
7楼-- · 2019-03-23 08:57

I've had the same error - my issue was that MS has modified the way MSBuild looks for the versions of VS in the build process template.

Make sure to use the right build process template. If using TFS2013 and VS2013 use TfvcTemplate.12.xaml

查看更多
登录 后发表回答