Build separately a web app backend in a Xamarin solution using VSTS - xamarin

Got a Xamarin solution which includes a project for a web app backend.
Trying to set up a separate build definition for the web app backend so that it deploys to Azure app service. We have that API app folder inside the Xamarin solution folder.
When trying manual mapping to build the web app it fails as it tries to build the whole solution while it should only build that project as I used MSBuild task and pointed it to the csproj file in that folder.
How can we get that specific folder to build separately?

There are two ways to just build a project:
Build solution with /t:[projectname] MSBuild arguments (e.g. Visual Studio Build step; Solution: *****.sln**; MSBuild Arguments: /t:ConsoleApplication1; Platform: $(BuildPlatform); Configuration: $(BuildConfiguration)))
Specify the project file directly for Visual Studio Build or MSBuild step/task. (e.g. Visual Studio Build; Solution: [project file (csproj) path]; MSBuild Arguments: /p:OutputPath="bin\$(BuildConfiguration)\\" Platform: $(BuildPlatform); Configuration: $(BuildConfiguration))

Related

How to automate publishing .NET web applications

There is a Visual Studio solution that has multiple web application projects. All of them are to be published to a common folder - D:\inetpub\wwwroot\FirstSite.
Each project has a publish profile Local.pubxml which imports settings from a global publishsettings.xml, and I use the One-Click Publish feature to publish each project.
Now, I would like to automate this process, which will Rebuild the solution and on success, publish all the projects to the target folder.
I have managed to create a Console application using C#, which can build all the projects in a solution. But, unfortunately could only go that far, as I'm unable to figure out how to get started about the publishing.
I'm not looking for setting up a build server. Just want to save time publishing projects to local folders.
Can we achieve this in a console application, by passing parameters like 'solution path' & 'target folder path', so that it can work for any such solution with multiple projects.
If not, are there any simple tools for this.
When you invoke msbuild for the solution build, you can pass
/p:DeployOnBuild=true /p:PublishProfile=Local /p:SkipInvalidConfigurations=true
which will publish each project with the Local profile for you

WebDeployment is not

I am trying to deploy an web application that was created on VB with the .NET Framework 2.0 using the TFS 2017 continuous deploy. It doesn’t have a solution file inside like vbproj or csproj, so I needed to avoid all the suggestions to include extra information on the vbproj.In order to run the MSBuild even locally I need to change in my .sln this tag, so all my compiled code is also there
Debug.AspNetCompiler.TargetPath = "....\PrecompiledWeb\ARB\Debug\"
Unfortunately, I can’t deploy the application using the TFS. So far I tried to deploy it through my Visual Studio project, and is working fine with every option: I tried MSDeploy, Web Deploy Package, and FileSystem, and is working fine from the Visual Studio Publish Option
With that, even my transformation take place.
Now lets say I go to my TFS and I put this parameters on the MSBuild
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsASingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="\\MyServer\Content"
My files are compiled but never stored in my Content folder. No one of them!!! I can’t figure out what is going on here.
From your screenshot, you are using a Web Site project, not a Web Application project. The output structure of a Web Site project in TFS is different from build in VS (you can see a PrecompiledWeb folder in your build source directory on build agent server). Instead of using MSBuild argument, you can consider add tasks below to copy the files you want to publish:
We strongly suggest you switch from Web Site projects to Web Application projects to avoid these issues.

Call custom Umbraco targets during TFS build

Is there a way to trigger the custom deployment targets through a TFS build? We are using TFS 2015 (with VS 2015, git repository) and I started with a Visual Studio build definition template, but the custom targets (UmbracoCms.targets) do not get triggered so the umbraco, umbraco_client, and other folders do not get collected in the deployment to the artifacts folder.
I have gotten the publish profiles from within Visual Studio to work correctly multiple times before.
Specifically, here is my configuration:
Solution: $(SolutionPath)
MSBuild Arguments: /p:OutDir=$(build.stagingDirectory) /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true
Platform: $(BuildPlatform)
Configuration: $(BuildConfiguration)
Clean: No
Restore NuGet: No
VS Version: 2015
Cross posted on our.umbraco.com
After more experimenting I found that the below MSBuild parameters published the site as expected (specifically the PublishProfile parameter). I still consider this non-ideal since part of my goal was to create a system where deploying to staging (or production) couldn't be done from Visual Studio without a lot of work and would normally have to go through TFS (for the audit trail). Using the built in publish profiles fundamentally requires the Visual Studio setup I was trying to avoid but I haven't found any alternatives.
/p:OutDir=$(build.stagingDirectory) /p:DeployOnBuild=true /p:PublishProfile=Intranet.pubxml

Build not publishing Web API project in Visual Studio Team Services (was VS Online)

I have created a VS build definition on Team Services. The build runs successfully when I queue it and it also outputs the dlls for all the projects in the solution except the service layer which I have created using Web Api2.
when I download the artifacts from the drop location, I have folders holding the dlls for the data layer, the business layer and other helper projects. What I don't have is the main service layer dll which I can deploy to my IIS.
Here is a screenshot of my publish settings.
What could I be missing ?
It seems that you are using the default settings for the build definition. With these settings, the contents for "Copy Files" task is "**\bin\$(BuildConfiguration)**" while web api project does not have buildconfiguration folder. So it cannot find the files for web api project. To copy these files, add one more "Copy Files" task and configure the settings as following:
If you want the deployment files for the project, you need to set you build definition as following:
Add arguments /p:DeployOnBuild=true;OutDir="$(build.artifactstagingdirectory)" for Visual Studio Build step.
Remove Copy Files step.
Set Path to Publish to $(build.artifactstagingdirectory)\\_PublishedWebsites for Publish Build Artifacts step.
Then you should get the deployment files in the drop folder.
Open the Configuration Manager in VisualStudio and ensure the WebAPI project is included for the configuration (Debug, Release, etc) that you are building.

Configure Teamcity to build a published website with Visual Studio

How does one configure the teamcity build process to produce the same compilation result as if I told Visual Studio to publish a website from Visual Studio?
basically, I need teamcity to build the website with a publishable package...then publish the package as an artifact, which I can then deploy on AWS using command line commands.
Is it possible? What are the command line MSBuild parameters necessary to get Visual Studio to spit out what I am looking for, and what would I need to match in the build output in order to publish the package? Currently, the website is too big for me to publish everything as an artifact, so I'm having trouble figuring out what to match for artifact publishing.
You need to build target WebPublish - that's what VS does when you select web project and publish it from context menu.

Resources