Web Api Project Fails to build with Visual Studio Team Services (was TFS Online) - tfs

I have a project inside a solution and Visual Studio Team Services is setup to do continuous build.
The test project that includes the Web API project builds fine and even includes the artifacts from the web api project, but when I look at the drop folder from artifacts view it doesn't have a sub folder for the website.
This is done with a new default Visual Studio Build definition with bone stock settings. (no amount of playing around works either)
(I'd put in a screen shot but literally just create a new build definition as choose visual studio and continuous integration and click ok, and that's exactly what this is.)
The log file for the build step doesn't show that it even tries to build the csproj for the web api project and just skips right to the Tests project. (and no errors in the log either)
Going to configuration manager for that configuration (and all configurations) and the project in question is set to build.
It builds properly in that configuration with that project just fine.
It publishes from Visual Studio with that project just fine.
Any ideas why it won't build the project?

According to the information you provided, you are using a default build definition for Visual Studio CI without any other settings. This definition does not generate the web app publish files.
Try adding following MSBuild Arguments in "Visual Studio Build" step and then queue a new build:
/p:DeployOnBuild=true /p:outdir=$(build.artifactstagingdirectory)
Update:
Since you want to deploy the website by Azure Deploy from Release Management, you can just upload the deployment packages to drop. To do this, change the MSBuild Arguments to following:
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"
And then you can go to Release Managament, in the "Azure Web App Deployment" step, set "Web Deploy Package" to "$(System.DefaultWorkingDirectory)\**\ProjectName.zip".

Related

TFS msdeploy with publishprofile options does not work

I have installed TFS 2018 Community and was trying to publish a project to plesk domain using one of the publish profiles in the arguments of msdeploy task as shown in the picture below but it only build the project but did not publish it like I thought it would
Generally if you can run the msbuild command successfully with the arguments on local VS, then it should be also available in TFS.
So, please check below things to narrow down the issue:
Just make sure you have the same components installed and configured
on your build agent machine.
Make sure you have the correct configuration for your build
definition.
Based on your screenshot above, just try to set the correct buildPlatform and buildConfiguration (consistent with your project settings in VS).
Also verify that if you have checked in the PublishProfiles, and check the first Get sources step, make sure the system can get the sources and PublishProfiles during the build process.
This article for your reference : TFS 2015: deploy website to IIS without installing extra add-ons to TFS
UPDATE:
In order to use Publish Profiles on the build server, you have to have some of Visual Studio's prerequisites. Make sure you have installed the full version of Visual Studio on the build agent machine.
Besides, you can try with below arguments (Just change the PackageLocation value accordingly) :
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"
Referecne: Working with Web Deploy and Release Management for the deployment.

Visual Studio Online - Error TFS 22501 with XAML Build Definition 2

Currently, we are using TFS 2012 and we have a heavily customized build process as described below.
1. Build the source
2. Run an EXE as console to host WCF services
3. Restore databases on local sql server
4. Run functional test
5. delete databases
6. close the exe started in step 2.
7. Create an Installable exe using WiX ( Wix with custom bootstratpper)
8. Update version number file to TFS
Now we want to move to Visual Studio online from onpremise. Trying to setup a build process with Private Build agent. I have created an VM , installed and registerd agent. I do see agent name back in website.
When I go back to Visual studio and try to create new xaml build definition I am getting below error.
TFS22501: Creating a build definition requires a build controller be defined for this team project collection. There may not be any controllers configured or you may not have permissions to view them. contact your team foundation server administrator.
can somebody please help ?
If you're using XAML build, you have to use the old-style XAML build controller/agent. The VSTS agent is for the new build system.
I would strongly recommend migrating your builds to the new build system as part of your migration to VS Team Services, as the XAML build system is effectively dead.

VSTS Build Not Dropping All Files for Web Application

When I started writing this question, my problem was that after a successful VSTS Build, I wasn't able to see the files relating to my web application project for release. Only the files from certain other projects in the solution were present. However, I just came across this question, which has helped.
I can now see the compiled .dll files for my web application project, after altering the configuration of the Content setting in the Build - that is, the contents of the Bin folder under that project. But I can't see anywhere the other files I need to copy the built web application to my server - the views, the scripts, the css, etc.
I'm finding the power and flexibility of VSTS's Build and Release functionality very confusing as it's complete overkill for our requirements. Up until now, I've just right-clicked on the web app project in Visual Studio selected Publish and used the File System publish method. Easy. Now that I want to automate the building and deploying of the application, it's many times more complicated!
So, can anybody tell me how I can get the solution to build in VSTS in such a way that I can then use a Copy Files task in the Release Definition to copy the files to our web server (the server isn't visible to the Internet so I'm using a locally-hosted Agent)?
In vNext build, to publish your build artifacts with the Copy files or Publish build artifacts steps. Try to use the local path on the agent where any artifacts are copied to before being pushed to their destination. For example:
Add /p:DeployOnBuild=true
/p:OutDir="$(build.artifactstagingdirectory)\" arguments in Visual
Studio Build step;
Change "Path to Publish" of Publish Build Artifacts task to
$(build.artifactstagingdirectory)\_PublishedWebsites\ProjectName:
Details please check the screenshot of build step with this question: How do I get the the expected output from a TFS 2015 build (to match my XAML build)?
Base on your comments, you have published the web app from Visual Studio. Usually, this action will generate a publish profile under Project/Properties/PublishProfiles folder. The settings you used to publish the web app is stored in the profile. So you just need to make sure this publish profile is checked into source control. And then in the TFS build, add following MSBuild arguments:
/p:DeployOnBuild=true /p:PublishProfile="publishprofile.pubxml"

How to create a web deploy package for a website project during TFS build process?

My current TFS build process just build my website project and output all the files, such as assemblies, web.config, etc.
From here, I learned how to create a web deploy package with MSBuild in command line.
But I want to know how to insert this package step into my current TFS build process.
Thanks for any insight.
Create your release package by creating a publish profile through Visual Studio. For this example mine is called Release. this will create you a Release.pubxml file in a folder called Publish Profiles, under your project, check this into source control.
Then in your build definition, under the process tab.
Expand the 02. Build > 5 Advanced or similar depending on the version of TFS you are using, add the following to the MSBuild argument text box
/p:DeployOnBuild=true;PublishProfile=Release
ensure the PublishProfile has the same name as the one you created earlier (Release)
this will create your deployment package as part of the build

TFS Build- Deployment

I am trying to do a full CI-CD cycle using TFSonline.
when I go with 'AzureWebsite' along with Visual Studio Online, it provides me with a build definition using 'tfvccontinuousdeploymentTemplate.12.xaml'.
On check-in I get the output, the build triggers and deployment also happens to the azure website. The log contains build along with my deployment details, which is also reflected on the TFS portal
When I go the conventional iis route, I tried 2 steps
With Default build template and the good old ms build arguments /p:DeployOnBuild=true /p:VisualStudioVersion=12.0 /p:PublishProfile="dasd.pubxml" this does the build and deploy but I don't get the 'deployment summary', which is to be expected, because i did it via ms deploy...
I used the tfvccontinuousdeploymentTemplate and provided the build settings as the publish xml... well... build happens but the deployment does not
I'd like the build to contain the deployment summary for my deployment.
TFS Online has since been replaced by Visual Studio Online and since by Visual Studio Team Services. The XAML based build engine has been marked for deprecation and will be removed from Team Services in the near future.
The hosted build controller has since been upgraded with build templates for Visual Studio 14, upgrading to the latest tfvccontinuousdeploymentTemplate.14.xaml may also sole your issue until the XAML build engine is removed.
The new Build Engine ships with a "Deploy to IIS" task and there is a 3rd party MSDeployAllTheThings extension which makes it very easy to pick up packaged Web projects.
Your solution to switch to InRelease has since also been replaced by 2 different versions of Release Management and the latest release management feature uses the same tasks as the new build engine uses. So it's able to use the same Deploy to IIS and MSDeployAllTheThings task.
Due to the fact that this question is related to a SaaS solution, the old options are no longer available or will soon be removed.

Resources