Error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\BizTalk\BizTalkC.targets" - visual-studio-2013

I am part of doing BizTalk server 2013 R2 CI and CD using VSTS. I am getting below error
"Error MSB4019: The imported project "C:\Program Files
(x86)\MSBuild\Microsoft\BizTalk\BizTalkC.targets" was not found.
Confirm that the path in the declaration is correct, and that
the file exists on disk."
I have installed agent locally also. I am using BTDF5.6, VS2013, BizTalk 2013r2.
Please advise.

Building a BizTalk solution on a build server requires that you install the build components on the build server using the BizTalk product installer. You need to get the BizTalk 2013 R2 install media on the build server, run the installer, and check the Project Build Component.
(Do not check the other components shown as checked in the screenshot -- it was taken on a BizTalk dev machine.)

Related

Nuget Restore in a Docker Container

I am trying run nuget restore mySolution.sln in a docker container.
For the most part it seems to work just fine. The packages seem to restore fine, but before they do, it shows this error:
C:\src\myProject\mySolution.csproj(317,11):
error MSB4226: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found.
Also, tried to find "WebApplications\Microsoft.WebApplication.targets" in the fallback search path(s) for $(VSToolsPath)
- "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0" .
These search paths are defined in "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin\msbuild.exe.Config". Confirm that the path in the declaration is correct, and that the file exists on disk in one of the search paths.
From what I read, this means I need the nuget package MSBuild.Microsoft.VisualStudio.Web.targets. I did a nuget install of that, but the error does not go away. (It just drops it where ever I run it. I tried putting it with my solution and in the packages folder. Neither had any effect.)
How can I fix this error using command line tools? (No GUI because this is a docker container).
I assume what you're trying to build is a web-application, but you haven't installed corresponding workloads in your build tools package.And that's the cause of this issue. (Agree with imps)
Open the Visual Studio Installer in Start menu and you can modify the workloads of your msbuild package:
I only use the msbuild build tools package to build C++ desktop projects in server, so I only install the Visual C++ build tools workload. For you, you have to install the build tools for Web applications so that you can get the necessary files to build web-applications.
Update:
error: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found.
After I install the Web development build tools, I now get the newly created WebApplications folder in path C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0.

Build VS 2015 extension on build server without VS installed?

Is it possible to build a Visual Studio 2015 extension project on a build server (TeamCity agent) without Visual Studio installed? What kind of SDK do we need to install?
At the moment we receive the following error message:
error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\Portable\v4.6\Microsoft.Portable.CSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
So there is definitely some kind of SDK missing.
Microsoft.VSSDK.BuildTools
Contains targets and tools to enable the building of managed VSIX
projects without VSSDK MSI installed. Only for VS 2015 and onwards
Additional packages that may be of interest:
https://www.nuget.org/profiles/VisualStudioExtensibility
Using #weir's answer almost worked - the project built successfully, but it failed to produce a VSIX container at the end. For some reason the Nuget package hadn't added the necessary Import to the .csproj to bring in the VsSDK.targets, so the VSIX targets were missing and never got executed.
Here are the steps which worked for me:
Edit the VSIX project .csproj file, and remove Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />. This will fail on the build server where the VSSDK doesn't exist in the VSToolsPath.
In the VS2015 IDE, open the Nuget Package Manager for the project, and install Microsoft.VSSDK.BuildTools (I used v14.3.25407)
Back in the .csproj file, find the import which the Nuget package added, e.g. <Import Project="..\packages\Microsoft.VSSDK.BuildTools.14.3.25407\build\Microsoft.VSSDK.BuildTools.targets" .../> and add another one below it for the VsSDK.targets file (inside the tools directory), <Import Project="..\packages\Microsoft.VSSDK.BuildTools.14.3.25407\tools\vssdk\Microsoft.VsSDK.targets" .../>
It looks like you have to install the Portable Library Tools on the build agent. You can download them from the VS Gallery and install them without having VS on the build agent using the following parameter /buildmachine.
Download Microsoft Build Tools 2015

MSBuild fails due to invalid NuGet version on build server

I updated to VS2015 this week and along with that updated all NuGet packages in my website solution.
The site builds and run fine locally, however when doing my gated check in to my build server, I get the following when the build fails
As you can see the packages are complaining about the NuGet version, but I'm unsure how to update the NuGet version on the build server. I do have admin privileges to the server, but following the guild described at: http://blog.stangroome.com/2014/02/04/update-nuget-exe-version-used-by-team-build-2013-package-restore/ did not help. For one, my folder was actually C:\Program Files\Microsoft Team Foundation Server 11.0\Tools unlike the C:\Program Files\Microsoft Team Foundation Server 12.0\Tools described in the guide, but additionally I did not have a NuGet.exe within the folder.
I've done a full hard drive search of NuGet.exe, but could not locate it in any directories aside from the directories that are directly related to project source code (.nuget\NuGet.exe).
I have opened visual studio on the server and updated the NuGet version within "Extension and Updates" hoping that would fix the issue, unfortunately it did not.
Any ideas on how to fix the issue/errors presented in the screenshot?
The problem is that you're using the old-style, deprecated-since-NuGet 2.7-style "package restore" that's based on modifying your CSProj files to include references to a NuGet.targets file and a copy of NuGet.exe that gets put into a .nuget folder and ends up source controlled.
Basically, the version of nuget.exe that's on the build server is irrelevant right now -- your CSProj files are pointing to the file in your .nuget folder.
TFS 2013 and beyond has support for automatic package restore without using the NuGet.targets method. You can migrate off of it pretty easily: https://docs.nuget.org/consume/package-restore/migrating-to-automatic-package-restore

error MSB4019: Microsoft.WebApplication.targets" was not found

I created a project using Visual Studio 2010 and trying to create the build in TFS 2013. I am getting the following error. Target Framework is 4.0. Why my build server is looking for Visual Studio 12.0 folder? How to change this settings? I appreciate any suggestions.
error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\WebApplications\Microsoft.WebApplication.targets" was not found
Copy the directory "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0" from development machine to the build machine.
http://howtoscript.blogspot.com.tr/2014/05/error-msb4019-imported-project-cprogram.html?view=magazine
You need to do one of the following:
Change the build configuration to use 2010
Install VS 2013 on the build server.
I would recommend upgrading your visual studio anyway as you are already 2 versions behind with CTP's already available for DEV14,..

Building deployment package with Visual Studio 2012

We were building a Visual Studio 2010 solution with the following msbuild command:
msbuild MySolution.sln /p:DeployOnBuild=true;DeployTarget=Package
This command built the solution and created the deployment packages for web projects in the solution.
But after we've migrated to Visual Studio 2012 this command doesn't work anymore. The solution is built, but no deployment packages are created.
How to fix it?
The problem was exactly the same as in this question.
Copying *C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web** from a local machine to a remote CI server.
I use this manually, should be a matching msbuild parameter
Using the Publish Web Wizard to Create a Deployment Package

Resources