Visual Studio Build Tools 2017 for Office VSTO - msbuild

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?

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:
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:
Create a Excel 2013 and 2016 VSTO Add-in project with VS 2017.
Publish this project from VS manually, then ProjectName_TemporaryKey.pfx file will be generated. Check this project include .pfx file into TFS.
Edit build definition with MSBuild task. and add /t:Publish /p:PublishDir="pub/" to MSBuild argument:
Save and build this project.
According to the build log, this project publish successfully:
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:

Related

How can override platform tool set for msbuild from command line? How I am doing it is not working

I am pulling in open source project but it is configured to build using MS VS 2015. I am trying to override this command line option on msbuild. But is still tries to use MSVS 2015. Following is my command invocation:
msbuild path/to/solution/file/file.sln /p:ToolsVersion=15.0 /p:PlatormToolset=v141 /p:WindowsTargetPlatformVersion=10.0.19041.0 /p:Configuration=Release
I get following error:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.target
s(67,5): error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 b
uild tools, please install v140 build tools. Alternatively, you may upgrade to the current Visual Studio tools by sele
cting the Project menu or right-click the solution, and then selecting "Retarget solution".

Using MSBuild to build SSDT projects with VS2017 fails

I am trying to set up continuous integration of .sqlproj SSDT projects on our windows server 2016 server.
In order to do this I have installed VS2017 and SSDT tools onto the server to get the required tools. I have also installed MS build tools 2017.
The issue I am currently having is regarding what looks to be miss-matched versions of installed ms build tools and ssdt.
The command i am using to run the build is as follows:
C:\\Windows\Microsoft.NET\\Framework64\\v4.0.30319\\MSBuild.exe /p:VisualStudioVersion=15.0 /property:MSBuildExtensionsPath="C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\MSBuild\\" /property:VsInstallRoot="C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\" DPAP-SQL-Slim.sln
The two switches passed there are to set two environment parameters that the .sqlproj file is expecting to find when run through Visual studio. This is done because MSBuild does not supply them by default.
The error i am currently getting is as follows:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(477,5): error MSB4062: The "SqlModelResolutionTask" task could not be loaded from the assembly C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\Common7\IDE\Extensions\Microsoft\SQLDB\Dac\140\Microsoft.Data.Tools.Schema.Tasks.Sql.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
Now, i can see from running the command: gacutil /l in the VS2017 command prompt that the apparently installed version of the Microsoft.Build.Utilities.Core dll is v14: Microsoft.Build.Conversion.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
Am i missing something key here? It appears that installing build tools 2017 did not in-fact update the GAC and register the correct DLLs.
Do not use the msbuild.exe included in .NET Framework (C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe). It is old and does not support some features of newer msbuild versions.
Always use the version of MSBuild installed with visual studio or the build tools. Depending on the version of VS installed, this could be
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe
Starting in VS 2017, MSBuild is also not installed system-wide but many versions (e.g. VS 2017 preview versions, different editions like Build Tools / Enterprise / Community etc.) can be installed side-by-side, which is why you won't find these MSBuild assemblies in the GAC.
I was having this issue building a SQL Server project on a CI/CD pipeline. None of the pre-built build tasks on Azure DevOps would work for me. I solved this by avoiding to add a SQL Server project to the solution.
I achieved this by using an MSBuild SDK, capable of producing a SQL Server Data-Tier Application package (.dacpac) from the set of SQL scripts. By adding this second project to the solution, I managed to continue taking advantage of linking the project to a live database through SQL Server Object Explorer on Visual Studio. I gave a more detailed explanation in this answer.

MSBuild 15 missing after installation

I have recently upgraded to VS2017 and building with TeamCity. I have a new project that I need to build using TeamCity.
I tried to install MS Build on the CI server from the following link https://www.visualstudio.com/downloads/ it said that it has successfully installed it. Restarted the CI server trying to build the project and still cannot find the new Build tools.
I checked under C:\Program Files (x86)\MSBuild\15.0\ but I dont see the MSBuild.exe
MSBuild 15 missing after installation
If you want use MSBuild without install Visual Studio, you should download and install vs_BuildTools.exe from below link:
https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15#
After installation complete, you will find the MSBuild.exe under the path:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin
For more detail information, you can refer to: How can I install the VS2017 version of msbuild on a build server without installing the IDE?
MSBuild is now local to Visual Studio 2017
and multiple versions can be installed side-by-side (e.g. build tools, previews, community + enterprise, etc.)
So a path to msbuild.exe could look like:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin

Visual Studio 2015 Build Tools missing DNX

I've installed Visual Studio 2015 Build Tools onto our TeamCity server but the DNX folder is missing from within its installation root.
MSBuild 14 won't build an xproj because it imports Microsoft.DNX.targets
I've installed the latest DNX via the DNVM but it didn't create the DNX folder I was hoping it would.
The folder is obviously there on my dev box with VS2015 installed. I guess I could install the VS Community Edition, but why would the build tools be missing a crucial component??
Right now the DNX MSBuild targets are only installed with Visual Studio 2015 (specifically the Web Development Tools component).
https://github.com/aspnet/dnx/issues/2207#issuecomment-120076364
So it looks like I'll have to install Visual Studio 2015 Community Edition on the build server.
People are saying I should be using dnu from the command line, but the issue is that I need to make an MSDeploy package, and AFAIK, only MSBuild can do this.
Looks like I need to read this.
http://docs.asp.net/en/latest/publishing/iis.html

Getting msbuild.exe without installing Visual Studio

How do you get msbuild.exe without installing those crazy Visual Studio programs?
I need it for an npm install to finish working. I'm on Windows 7 and can't get on older version of Visual Studio 2013 Express online.
The latest (as of Jan 2019) stand-alone MSBuild installers can be found here: https://www.visualstudio.com/downloads/
Scroll down to "Tools for Visual Studio 2019" and choose "Build Tools for Visual Studio 2019" (despite the name, it's for users who don't want the full IDE)
See this question for additional information.
It used to be installed with the .NET framework. MsBuild v12.0 (2013) is now bundled as a stand-alone utility and has it's own installer.
http://www.microsoft.com/en-us/download/confirmation.aspx?id=40760
To reference the location of MsBuild.exe from within an MsBuild script, use the default $(MsBuildToolsPath) property.
You can also get the MSBuild executable as a Nuget package https://www.nuget.org/packages/Microsoft.Build.Runtime/.
Download MSBuild with the link from #Nicodemeus answer was OK, yet the installation was broken until I've added these keys into a register:
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\MSBuild\ToolsVersions\12.0]
"VCTargetsPath11"="$([MSBuild]::ValueOrDefault('$(VCTargetsPath11)','$(MSBuildExtensionsPath32)\\Microsoft.Cpp\\v4.0\\V110\\'))"
"VCTargetsPath"="$([MSBuild]::ValueOrDefault('$(VCTargetsPath)','$(MSBuildExtensionsPath32)\\Microsoft.Cpp\\v4.0\\V110\\'))"