Ant
Ant

Reputation: 767

Visual Studio Build Tools 2017 for Office VSTO

I have installed the vs build tools 2017 on a build server. When I try to build with /t:Publish /p:PublishDir="pub/" I get _DeploymentUnpublishable: Skipping unpublishable project.

Is there a way to fix this or do i need to install the full VS with office developer tools?

Upvotes: 0

Views: 2156

Answers (1)

Leo Liu
Leo Liu

Reputation: 76986

Is there a way to fix this or do i need to install the full VS with office developer tools?

I got the same error with your MSBuild arguments on command line:

enter image description here

You need to configure the MSBuild command line on your build server with those two additional arguments: /p:DeployOnBuild=true and /p:PublishProfile=your_publish_profile.pubxml instead of /t:Publish /p:PublishDir="pub/.

So the MSBuild command line should be:

msbuild.exe "YourProjectName.csproj" /p:DeployOnBuild=true /p:PublishProfile=PublishProfileName.pubxml

Of course, you need create the publish profile .pubxml, You don't need to specified path to publish_profile.pubxml as long as it's under the PublishProfiles directory with your project file.

Update for Ant`s comment:

Since your project type is a "Excel 2013 and 2016 VSTO Add-in", not "Excel Web Add-in", we should use ClickOnce publish method to deploy project. I have created a sample demo with VS 2017 and build it with TFS 2017. You can check if it helps:

  1. Create a Excel 2013 and 2016 VSTO Add-in project with VS 2017.
  2. Publish this project from VS manually, then ProjectName_TemporaryKey.pfx file will be generated. Check this project include .pfx file into TFS.
  3. Edit build definition with MSBuild task. and add /t:Publish /p:PublishDir="pub/" to MSBuild argument:

enter image description here

  1. Save and build this project.

According to the build log, this project publish successfully:

enter image description here

Note: Add the .pfx file to your build server and my build server installed VS 2017, but AFAIK, you do not need to install the entire VS, you should install the workload Office/SharePoint development:

enter image description here

Upvotes: 2

Related Questions