how to create build definition on Visual studio Team Services for a web role to send package to a drop location - azure-devops

I have loaded my web role project to Visual Studio Team Services. In the VSTS portal I created a new build definition. I added tasks Visual Studio Build and Publish Artifacts.
Task Visual Studio Build
MSBuild Arguments: /t:Publish /p:PublishDir=PublishDir\ /p:TargetProfile=Cloud
Publish Aritifact:drop
Path to Publish : $(Build.ArtifactStagingDirectory)
However after I run this definition I go to "Artifacts">"Explore" there is nothing in the drop location.

We use worker roles but the deployment sequence should be the same (unless you're talking about web apps and not roles)
In build arguments we target the ccproj and add that /t:Publish /p:TargetProfile=$(targetProfile) /p:SkipInvalidConfigurations=true /p:OutputPath=bin\ /p:PublishDir="$(build.stagingDirectory)\\"
Then we have a deploy cloud service step with that as arguments for the packages $(build.stagingDirectory)*.cspkg and $(build.stagingDirectory)*.cscfg
Hope that works for you!

Related

Code Coverage not showing in Azure Devops after enabling options

I have service fabric project .net core 2.1 project and have created unite test case. I added the VSTest step after the build step and enabled "Code Coverage Enabled" but I do not see any information related code coverage after the build.
You need the test sdk's running on the agent (VS Pro or Enterprise). You can also use the Visual Studio Test Platform Installer task for this, as this will install all the necessary tools.
You need to publish the test results with a task 'Publish test results' if I am correct.

VSTest-Task not running .NET Core 2.1 xUnit-Tests from Test-plan

I'm trying to create a release pipeline in VSTS that runs my xUnit-tests as specified in a Test Plan.
Long story short: I can't get it to work.
What I'm using:
Azure DevOps (formerly VSTS)
Visual Studio Test task (v2.*)
Test project targeting .NET Core 2.1
xunit 2.4 with xunit.runner.visualstudio 2.4
In Azure DevOps I defined a Test Plan that contains a Test Suite which contains a Test that has an Associated Automation which points to my xUnit test.
I had to use the REST API to link the test code to the Test as described here.
I can select that Test in the visual designer for the VSTest task.
When I run the release pipeline the VSTest task fails with the following error message:
DiscoveryMessage : System.IO.FileNotFoundException: Unable to find tests for D:\a\r1\a\Foo.Tests.dll. Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk" and framework version settings are appropriate. Rerun with /diag option to diagnose further.
The path to the Foo.Tests.dll is correct, all required files are copied as well.
I explicitly specified the framework version in a .runsettings file (as the option Other console options doesn't work when using the Test plan option).
Specified the path to custom test adapters
used Visual Studio 2017 and Installed by Tools Installer options
Added a .NET Core Tool installer to install the correct .NET Core SDK
...and any other combination of settings I could think of.
The error message is still the same.
Any ideas what I might be missing? Your help would be greatly appreciated at this point!
After several more hours we stumbled across a web page that stated that you don't have to copy the binaries of your test project as input for the VSTest task but PUBLISH it instead. That never came to mind as vstest.console.exe runs smoothly when you point it at the binaries on a local machine.
UPDATE: We had to add a Publish Artifact task at the end of our Build Pipeline and make the Release Pipeline pick up the published artifact.

Deploy + desktop application + TFS 2017

I have a winForm application. I want to install it on the server every time the CI/CD happens. Later, after I install it(i don't know how to automate installation as well.), I want to run UI tests on it. What task should I add to my release management?
I only found web deployment when I researched. Since, mine is a desktop application, I need different build/release task. I could do it from vs2017(by right click project + publish)
I want similar one from TFS 2017.
You can try to build with the publish profile. See Publish profile.
In TFS using VS Build step with the MSBuild Arguments something like below:
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(Build.StagingDirectory)\\" /p:PublishProfile="YourPbulishProfile"
You can reference this article : Using Web Deploy in Visual Studio Team Services Release Management
To run coded UI tests from TFS.
Firstly, you need to run your agent as an interactive process. Regarding how to deploy an agent on windows, please refer to this link.
Secondly, add your coded UI tests project into TFS version control.
Last, create a build definition to use Visual Studio Test Agent Deployment task and Run Functional Tests task to run the tests.
Reference below articles:
Continuous integration, test, and deployment tutorial
Deploy a Desktop App from TFS to VM for Coded UI Test.
I found a way to publish my desktop application on to the server. below is the article which explains the build tasks needed.
Click here

How deploy .NET Core web application via Visual Studio Team Services to hosting with IIS

I would like to deploy my .NET Core web application via Visual Studio Team Services to hosting with IIS.
I have tried to discover the possibility of deployment the final release but I don't know what type of task I can use.
I usually used the deploy via Visual Studio 2017 and using publish proccess with MSDeploy and setup profile like this:
<publishData>
<publishProfile
publishUrl="publishUrl"
msdeploySite="site"
destinationAppUrl="destinationAppUrl"
profileName="Default Settings"
publishMethod="MSDeploy" userName="login" />
</publishData>
This site is not running on azure but on shared asp.net hosting.
How can I setup the Visual Studio Team Services - Deploy release if I only know these information?
What type of task is necessary to use?
Since you can deploy it with publish profile, you can to do it in VSTS build/release too.
NuGet restore (2.*) or Dotnet restore task
Visual Studio Build task (MSBuild Arguments: /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:PublishProfile="[profile name]"
You can use IIS Web App Deployment Using WinRM tasks if you have admin account.
If the host supports FTP, you also can upload the published files through FTP task.

Visual Studio Online Build access denied

I'm very new to TFS but am using Visual Studio Team Services... which i believe are largely the same configurations and technologies.
Now its possible that VS Team Services only supports web projects but they to be the only type of project that i'm able to build. I've tried several other (non-web) project types including the default console project but I always get a build error similar to one below....
C:\Users\Mark\Documents\Visual Studio 2013\Projects\App1\App1\App.config:
Access to the path 'C:\Users\Mark\Documents\Visual Studio 2013\Projects\App1\App1' is denied.
I'll get a error like the one above for every file in the project.
Can someone confirm whether Visual Studio Team Services does support building other types of projects. If so, is there some special permission or additional setting in build definition that needs to be set prior to triggering build?
Thanks. Turns out all i needed to do was to switch the build template under Build Definition->Process--> Build Process file from default to 'TfvcTemplate.12.xaml'.