Search code examples
tfsbuildwcfserviceclient

Msbuild Arguments for publishing wcf service in TFS build


I am trying to publish a WCF service using a TFS build, but the build is failing.

I tried using the given arguments in VSBuild in TFS:

/p:DeployOnBuild=True /p:PublishProfile=TestDataProfile /p:PublishProfileRootFolder=$(RelativePath)\Properties\PublishProfiles 

This is happening because there are two WCF service in the sln and because of which the build is failing as it is not able to find the profile in other service.

How to make sure that only one service project is taken instead of one?

I tried to build only one csproj using MSBuild task in TFS, by giving this as parameters,

/target:Service.csproj

This leads to failure saying the target can't be found.

I also tried building one csproj using MSBuild in TFS, and i get the following error:

Cannot determine the packages folder to restore NuGet packages. Please specify either -PackagesDirectory or -SolutionDirectory.

Edit: This problem is resolved by debuging metaproj file and i got the correct parameter.

Now, While publishing to a TFS server, the PublishUrl has the path to a TFS server location like "(Server ip address)/Folder/PublishService".

This is leading to failure by showing the given issue:

 Publish Pipeline Deploy phase Stage PipelinePreDeployCopyAllFilesToOneFolder
WebFileSystemPublish:
Creating directory "\\Server ip\VishalBuildTest\ServiceData".
[error]C:\ProgramFiles(x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Deploy\Microsoft.Web.Publishing.Deploy.FileSystem.targets(93,5): Error MSB3191: Unable to create directory "\\Server ip\VishalBuildTest\ServiceData". Access to the path '\\Server ip\VishalBuildTest\ServiceData' is denied.

What permissions are needed to run this?

This works perfectly while doing it from MSBuild command prompt.

Any help is appreciated.


Solution

  • in VSBuild task:

    In sln path, give the specific solution which contains the WCF Service.

    Give the following MSBuild Arguments:

    /t:(Solution folder name)\(Service Assembly name) /p:DeployOnBuild=True /p:PublishProfile=TestDataProfile
    

    For example if your service assembly is A.B.Service then the ServiceAssemblyName=A_B_Service.

    In PublishProfile file, you need to specify the PublishUrl with the value of file server path where we want to publish this service.

    Also for access, you need to go the local machine where tfs is deploying and share the folder with TFS. You need to be an admin in order to acheive this.

    After this, just queue the build and it works.