Azure Pipelines - Where is the CodeCoverage generated by VSTest#2? - yaml

I have tried hundreds of times but I am still unable to find that codeCoverage file generated in VSTest task.
See the following code.
I simply want to publish the Code Coverage report to the pipeline.
Help, please!
Where is that code coverage file?
Or give me some links if you don't want to waste time writing some answers.
Many thanks!
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
trigger:
- master
jobs:
- job: devbuild
pool:
name: 'Self Hosted VS2017'
variables:
solution: '**/*.sln'
steps:
- task: NuGetToolInstaller#0
- task: NuGetCommand#2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild#1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:Configuration=Debug /p:Platform="Any CPU" /p:OutDir=".\output\dev"'
clean: true
- task: VisualStudioTestPlatformInstaller#1
inputs:
packageFeedSelector: 'nugetOrg'
versionSelector: 'latestPreRelease'
- task: VSTest#2
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\dev\*.Tests.dll
searchFolder: '$(System.DefaultWorkingDirectory)'
****************************************************************************
************THIS GUY =>****************************************************
codeCoverageEnabled: true
**********************<=****************************************************
****************************************************************************
distributionBatchType: 'basedOnAssembly'
dontDistribute: false
publishRunAttachments: true
- task: PublishCodeCoverageResults#1
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '**/coverage.xml'
reportDirectory: '**/coveragereport'
failIfCoverageEmpty: true

This is what worked for me. I had to tell vstest to output in Cobertura format, then publish coverage results manually:
- task: VSTest#2
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\*Tests.dll
!**\*TestAdapter.dll
!**\obj\**
searchFolder: '$(System.DefaultWorkingDirectory)'
resultsFolder: '$(build.ArtifactStagingDirectory)/Test/Results'
otherConsoleOptions: '/collect:"Code Coverage;Format=Cobertura"' # <<<< this is the important bit
codeCoverageEnabled: True
# vv Then add publish coverage manually vv
- task: PublishCodeCoverageResults#1
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: '$(build.ArtifactStagingDirectory)/Test/Results/**/*.xml'
Then I got the nice HTML output in the coverage tab in DevOps

Try to add resultsFolder parameter to control file location
# Ejecucion de los Test
- task: VSTest#2
displayName: 'Ejecucion de los Test'
inputs:
testSelector: 'testAssemblies' # Options: testAssemblies, testPlan, testRun
testAssemblyVer2: | # Required when testSelector == TestAssemblies
**\*.Test.dll
searchFolder: '$(Build.SourcesDirectory)\Test'
vsTestVersion: '15.0'
platform: 'x86' # Optional
codeCoverageEnabled: true
resultsFolder: '$(build.ArtifactStagingDirectory)\Test\Results'

Set system.debug variable to true, then queue build, you can find the whole path of coverage files (search coverage in log)
By default, the coverage file's name is xx.coverage.

This is what I had to do to workaround the "nice" handling that Azure's does with the results of the vstest.
First, run vstest.console, this way azure doesn't try to publish the test results by itself and gives you control on what's going on.
Then, used a powershell to rename the *.coverage into a known file.
That's what the only way I got to have my .coverage path in order to do a decent way of exporting my coverage into the pipeline (my results are from vstest running c++ and c#, which azure doesn't handle well).
Thanks.

Related

Why is .NET6 self-containing app too slow?

I have app in .NET6, my deployment manager needs them as a self-contained. So, I have changed YAML build command to following:
- task: DotNetCoreCLI#2
displayName: Publish service
inputs:
command: publish
projects: <my project>.csproj
publishWebProjects: True
arguments: '--self-contained true --configuration $(BuildConfiguration) --no-restore --output "$(Build.ArtifactStagingDirectory)\service" -p:Version=$(GitVersion.FullSemVer) /p:DebugType=None /p:PublishTrimmed=true /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=true /p:InformationalVersion=$(GitVersion.InformationalVersion)'
zipAfterPublish: false
In project file there are added new elements:
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
and appsettings.json files have added elements:
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
There is really produced a "single file" deployment (only file: Microsoft.Data.SqlClient.SNI.pdb lies next to).
But starting of the app takes ~ 30 minutes!? Reactions are 1000 times slower in comparation with non-self-contained deployment
What's wrong? How to diagnose it please?
Thanks for your answers, Petr

Specflow Test with Data Tables runs from Agent or Client Fails on Azure Pipeline VS Test Task

BLUF:
Without Specflow Data Table tests run fine from Azure Pipeline
With Specflow Data Table tests fail from Azure Pipeline
Setup
SpecFlow 3.1 or 3.3
MSTest as Test Runner
packages.config
.feature.cs files are generated using SpecFlow.Tools.MsBuild.Generation NuGet package
VS 2019
SpecFlowSingleFileGenerator Custom Tool option in Visual Studio extension settings Disabled
.NET Framework 4.5.1 (Framework on Self-hosted Machine .NET 4.7)
TFS/VSTS/Azure DevOps – Task – Visual Studio Test Task 2.*
Configuration
Visual Studio C# Selenium Test Project
Uses Extent Reports
DotNetSeleniumExtras Page Objects
MSTestTestAdapter and Framework
Selenium and Chrome Driver
Data Tables in the Feature File
Azure Visual Studio Tasks on Build or Release Pipeline
Test Assembly Runs with an .exe and not a .dll
Azure VSTest Task uses testhost.x86.exe
Actions:
Create a Selenium Specflow Test with a Data Table in Visual Studio
Push to a Repo
Set up a Build or Release Pipeline with a Visual Studio Test Task (Test acts the same way on either)
Run the Pipeline
Results:
Tests with or without data tables run without error from the client machine via Visual Studio Test Explorer
Tests with or without data tables run without error from the custom local agent machine via Visual Studio Test Explorer or when run with vstest.console.exe from the command line
Tests without data tables run without error from the custom local agent machine via Visual Studio Test Explorer or when run with vstest.console.exe from the command line
Tests with data tables fail with the following error from an Azure Pipeline Visual Studio Task
dmp file error: Process Name: testhost.x86.exe : C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\Extensions\TestPlatform\testhost.x86.exe
Process Architecture: x86
Exception Code: 0xC0000005
Exception Information: The thread tried to read from or write to a virtual address for which it does not have the appropriate access.
Heap Information: Not Present
System Information
OS Version: 10.0.14393
CLR Version(s): 4.7.3620.0
Azure PipelineError output:
Test method HappyTest.Features.CPUF.YPUCC_1 threw exception:
System.NullReferenceException: Object reference not set to an instance of an object.
AventStack.ExtentReports.Model.ExceptionInfo..ctor(Exception ex)
AventStack.ExtentReports.ExtentTest.Log(Status status, Exception ex, MediaEntityModelProvider provider)
AventStack.ExtentReports.ExtentTest.Fail(Exception ex, MediaEntityModelProvider provider)
UtilityLibrary.Utilities.Hooks.Hooks.InsertReportingSteps(ScenarioContext InjectedText) in D:\DevOpsAgent\_work\8\s\UtilityLibrary\Utilities\Hooks\Hooks.cs: line 188 lambda_method(Closure , IContextManager , ScenarioContext )
TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) in D:\a\1\s\TechTalk.SpecFlow\Bindings\BindingInvoker.cs: line 69
TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType) in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs: line 351
TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType) in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs: line 340
TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireScenarioEvents(HookType bindingEvent) in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs: line 321
TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnStepEnd() in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs: line 304
TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(IContextManager contextManager, StepInstance stepInstance) in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs: line 470
TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.Step(StepDefinitionKeyword stepDefinitionKeyword, String keyword, String text,
String multilineTextArg, Table tableArg) in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs: line 581
TechTalk.SpecFlow.TestRunner.Given(String text, String multilineTextArg, Table tableArg, String keyword) in D:\a\1\s\TechTalk.SpecFlow\TestRunner.cs: line 79
HappyTest.Features.CPUF.YPUCC(Anonymized Data Fields Here) in D:\DevOpsAgent\_work\8\s\HappyTest\Features\CreatePersonalUser.feature: line 12
HappyTest.Features.CPUF.YPUCC_1() in D:\DevOpsAgent\_work\8\s\HappyTest\Features\CreatePersonalUser.feature: line 11
-> Loading plugin D:\DevOpsAgent\_work\8\s\HappyTest\bin\Release\TechTalk.SpecFlow.MSTest.SpecFlowPlugin.dll
-> Using app.config
Given The user navigates to Sbn Test
:: The page type is HappyTest.Pages.BasePage
:: Sbn Test Page Displayed
-> done: BaseScenarioSteps.GivenUserNavigatesToSbnTest() (2.0s)
Given The user selects Personal Subscribe Yearly
:: The page type is HappyTest.Pages.SbnHome
-> error: Timed out after 10 seconds
:: WebDriver Stopped
YAML
pool:
name: qa-automation
demands:
- msbuild
- visualstudio
variables:
BuildPlatform: ''
BuildConfiguration: 'Debug'
steps:
- task: NuGetToolInstaller#1
displayName: 'Use NuGet 5.3.1'
inputs:
versionSpec: 5.3.1
- task: NuGetCommand#2
displayName: 'NuGet restore'
inputs:
restoreSolution: SeleniumTest.sln
- task: VSBuild#1
displayName: 'Build solution SeleniumTest.sln'
inputs:
solution: SeleniumTest.sln
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: PublishSymbols#2
displayName: 'Publish symbols path'
inputs:
PublishSymbols: false
- task: CopyFiles#2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(system.defaultworkingdirectory)'
Contents: '**\bin\$(BuildConfiguration)\**'
TargetFolder: '$(build.artifactstagingdirectory)'
CleanTargetFolder: true
OverWrite: true
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'
- task: VisualStudioTestPlatformInstaller#1
displayName: 'Visual Studio Test Platform Installer'
inputs:
versionSelector: latestStable
- task: VSTest#2
displayName: 'VsTest - testAssemblies'
inputs:
testAssemblyVer2: |
!**\*TestAdapter.dll
**\HappyTest.exe
!**\obj\**
runTestsInIsolation: true
otherConsoleOptions: '/Tests:Happy_1'
testRunTitle: 'Validate Specflow Data Table Tests'
diagnosticsEnabled: true
collectDumpOn: always
VS Actions Tried Unsuccessfully
Updated SpecFlow to Beta 3.3
Updated Selenium and most other packages
Updated Dependencies in app.config
Updated .NET Framework to 4.6.2 then reverted
Added Additional waits before and after browser rendering
Tried toggling between x86 vs x64 vs any cpu architecture on Build Platform
Used full app.config
Added 60 second WebDriverWait
Azure Actions Tried unsuccessfully:
Changed multiple parameters on the Build and Release Tasks
Changed all variables from release to debug
Tried tests on both Azure and Local Agents
Changed Visual Studio versions from 2017 to 2019 and latest on the VS Build Task
Checked Run Tests in isolation
Pushed Packages Folder to Release Drop

How to build Xamarin.Mac app on Azure pipelines

Azure pipelines has tasks that support building Xamarin apps for iOS and Android. For iOS this includes the optional capability to package a .ipa file that is suitable for upload to the store.
For my project I'm building a macOS app with Xamarin.Mac and looking to be able to automate the build in Azure pipelines, but get stuck at the packaging step. Using an msbuild invocation I can have the .app built and signed in the pipeline just fine.
The next step in the VisualStudio GUI would be clicking "Build->Archive for Publishing", which produces a .xcarchive file (not entirely sure what this is? Just a zip maybe?), then you can click "Sign and Distribute" to go through a wizard that will produce the .pkg file for submission to the store.
This part is what I can't find a way to do in the pipeline. Is there a manual command line way to build the signed .pkg file in lieu of direct support for Xamarin.Mac?
EDIT: I found this article, but adding the "/p:ArchiveOnBuild=true" argument to my msbuild invocation still has not produced an xcarchive file. The docs seem to indicate that it should, so I'm at a loss there.
Old post but never the less; I have just spent most of a day struggling with the same problem.
I found this excellent blog-post helping a bunch
https://witekio.com/blog/xamarin-mac-on-azure-devops/
The idea is basically to build on MacOS and use bash instead of Powershell
I ended up with the following pipeline:
trigger:
- master
variables:
#app data
outputAppName: '<Name of outputtet app without .app>'
projectName: '<Name of your project>'
#keys and accounts
azureSubscription: <Azure subscription for publishing result>
storageAccountKey: <storage account key>
storageAccountName: <storage account name>
storageContainerName: <storage container name>
# Working Directory
workingDirectory: '$(System.DefaultWorkingDirectory)/$(projectName)'
configuration: 'Release'
outputArtifactPath: '$(workingDirectory)/$(projectName)/bin/$(configuration)/$(outputAppName).app'
# Agent VM image name
vmImageName: 'macos-latest'
stages:
- stage: Build
displayName: Build stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
displayName: Check out
clean: true
#lfs: false # whether to download Git-LFS files
submodules: true # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules
persistCredentials: true
path: htpaa_backend_shared_util
condition:
- task: Bash#3
displayName: 'Change Mono version'
inputs:
targetType: 'inline'
script: |
SYMLINK=6_4_0
MONOPREFIX=/Library/Frameworks/Mono.framework/Versions/$SYMLINK
echo "##vso[task.setvariable variable=DYLD_FALLBACK_LIBRARY_PATH;]$MONOPREFIX/lib:/lib:/usr/lib:$DYLD_LIBRARY_FALLBACK_PATH"
echo "##vso[task.setvariable variable=PKG_CONFIG_PATH;]$MONOPREFIX/lib/pkgconfig:$MONOPREFIX/share/pkgconfig:$PKG_CONFIG_PATH"
echo "##vso[task.setvariable variable=PATH;]$MONOPREFIX/bin:$PATH"
- task: NuGetToolInstaller#1
displayName: 'Use NuGet'
- task: NuGetCommand#2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(workingDirectory)/*.sln'
- task: MSBuild#1
inputs:
solution: '$(workingDirectory)/*.sln'
platform: 'Any CPU'
configuration: '$(configuration)'
restoreNugetPackages: true
- task: ArchiveFiles#2
inputs:
rootFolderOrFile: '$(outputArtifactPath)'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId)_$(projectName).zip'
replaceExistingArchive: true
verbose: true
- task: AzureCLI#2
displayName: 'CLI Copy files to Azure Storage'
inputs:
azureSubscription: '$(azureSubscription)'
scriptType: ps
scriptLocation: inlineScript
inlineScript: |
az storage blob upload --account-name $(storageAccountName) --container-name $(storageContainerName) --name '$(Build.BuildId)_$(projectName).zip' --file '$(Build.ArtifactStagingDirectory)/$(Build.BuildId)_$(projectName).zip' --account-name $(storageAccountName) --account-key $(storageAccountKey)

How to setup CI/CD for nativescript using Visual studio online/Azure dev ops tools

Im try so setup a CI/CD Pipeline for a Nativescript app, added the commands to install node and npm install but nativescript has dependencies that it need. How do I go about on Azure dev ops dynamically without having to create a vm that has nativescript and all its dependencies installed and setup
So i have used a VM and install nativescript on it and used and agent to connect to the machine and build solution, i have done the same using jenkins but jenkins was running on the vm, no i want to move the whole pipeline on azure dev ops
command used in build step: tns build android
If you don't want to use a vm you'll have to install everything needed for nativescript before building it on their hosted agent each time you create a build for your app.
A couple of important things to note. First the name of your repository is changed to 's' this messes with the naming of your entitlement file... or at least it did for me. I fix this with a bash file I add to my repository that changes the name of the path in build.xcconfig for the CODE_SIGN_ENTITLEMENTS variable. I added an npm run entitle command in my package.json file to run this before building. Second you'll want to store all files and secure passwords in the library section under pipelines in you Azure Devops project. Third, Using the classic editor is your best friend for figuring out yaml as most jobs have an option to view the YAML. You can also use the classic editor as an alternative to the YAML file
The YAML and bash file below show an example of how you can build an ipa and apk file that is stored as an artifact. You can then use that trigger a release pipeline to push the the play and app store.
# YAML File
name: Release Build
trigger:
- release/* # will start build for pull request into release branch ie. realease/version_1_0_0, release/version_2_0_0
pool:
vmImage: 'macOS-10.13'
variables:
scheme: 's' # default name/scheme created on this machine for ipa
sdk: 'iphoneos'
configuration: 'Release'
steps:
- task: NodeTool#0
inputs:
versionSpec: '10.14'
displayName: 'Install Node.js'
# Download Secure File for Android
# Note: if multiple secure files are downloaded... variable name will change and break pipeline
- task: DownloadSecureFile#1
displayName: 'download android keystore file'
inputs:
secureFile: myKeystore.keystore
#Install Apple Certificate(Distrobution)
- task: InstallAppleCertificate#2
displayName: 'Install an Apple certificate Distribution (yourcertificate.p12)'
inputs:
certSecureFile: '00000000-0000-0000-0000-000000000000' # got id from viewing file in clasic editor for pipeline
certPwd: '$(myCertificatePasswordP12)' # password stored in Library
# Install Apple Provisioning Profile(Distrobution)
- task: InstallAppleProvisioningProfile#1
displayName: 'Apple Provisioning Profile(myProvisioningProfile.mobileprovision)'
inputs:
provisioningProfileLocation: 'secureFiles' # Options: secureFiles, sourceRepository
provProfileSecureFile: '00000000-0000-0000-0000-000000000000' # Required when provisioningProfileLocation == SecureFiles
# General Set Up
- script: |
npm install -g nativescript#latest
npm install
displayName: 'Install native script and node Modules'
# variable explination
# $DOWNLOADSECUREFILE_SECUREFILEPATH is keystore file downloaded earlier
# $KEYSTORE_PASSWORD refers to the environment variable in this script which references library variable
# $(MyPlayStoreAlias) refers to library variable for your apps alias
# $BUILD_SOURCESDIRECTORY location where apk is built to
# Android
- script: |
tns build android --env.production --release --key-store-path $DOWNLOADSECUREFILE_SECUREFILEPATH --key-store-password $KEYSTORE_PASSWORD --key-store-alias $(MyPlayStoreAlias) --key-store-alias-password $KEYSTORE_PASSWORD --bundle --copy-to $BUILD_SOURCESDIRECTORY #creates apk
displayName: 'Build Android Release apk'
env:
KEYSTORE_PASSWORD: $(MyPlayStoreKeystore)
# create apk artifact
- task: PublishBuildArtifacts#1
inputs:
pathtoPublish: '$(Build.SourcesDirectory)/app-release.apk'
artifactName: 'apkDrop'
displayName: 'Publishing apkDrop artifact'
# have to use xcode 10.1 to meet min standards for uploading ipa... default version for this machine was lower than 10.1
#changing xcode version
- script: |
xcodebuild -version
/bin/bash -c "echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_10.1.app;sudo xcode-select --switch /Applications/Xcode_10.1.app/Contents/Developer"
xcodebuild -version
displayName: 'changing xcode to 10.1'
# Optional... was running into build issues with latest version
#downgrading cocoapods version
- script: |
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.5.3
displayName: 'Using cocoapods version 1.5.3'
#iOS
- script: |
xcodebuild -version # makeing sure the correct xcode version is being used
pip install --ignore-installed six # fixes pip 6 error
npm run entitle #custom bash script used to change entitlement file
tns run ios --provision #see what provisioning profile and certificate are installed... helpful for debugging
tns build ios --env.production --release --bundle #creates xcworkspace
displayName: 'Build ios Release xcworkspace'
#build and sign ipa
- task: Xcode#5
displayName: 'Xcode sign and build'
inputs:
sdk: '$(sdk)' # custom var
scheme: '$(scheme)' # must be provided if setting manual path to xcworkspace
configuration: '$(configuration)' # custom var
xcodeVersion: 'specifyPath'
xcodeDeveloperDir: '/Applications/Xcode_10.1.app' #using xcode 10.1
xcWorkspacePath: 'platforms/ios/s.xcworkspace'
exportPath: '$(agent.buildDirectory)/output/$(sdk)/$(configuration)' #location where ipa file will be stored
packageApp: true #create ipa
signingOption: manual
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)' # distribution certificate
provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)' # distribution profile
#creating ipa artifact
- task: PublishBuildArtifacts#1
displayName: 'Publishing ipaDrop artifact'
inputs:
pathtoPublish: '$(agent.buildDirectory)/output/$(sdk)/$(configuration)/s.ipa'
artifactName: 'ipaDrop'
Bash file
#!/usr/bin/env bash
# filename: pipeline-entitlements.sh
echo "Editing build.xcconfig"
TARGET_KEY="CODE_SIGN_ENTITLEMENTS"
REPLACEMENT_VALUE="s\/Resources\/YOURENTITLEMENTFILENAME.entitlements"
CONFIG_FILE="./app/App_Resources/iOS/build.xcconfig"
echo "Editing $TARGET_KEY and replaceing value with $REPLACEMENT_VALUE"
sed -i.bak "s/\($TARGET_KEY *= *\).*/\1$REPLACEMENT_VALUE/" $CONFIG_FILE
echo "Finished editing build.xcconfig"

GitLab CI. Path in yml for different users

I'm trying to set up GitLab CI for .net project. Now I'm writing script in yml file. What I want to know: the path to the msbuild.exe and mstest.exe may be different for the different team members, how the same yml script may work for different users?
Or may be I'm understand how GitLab CI work in wrong way?
The path to the mstest.exe and all other referenced executable and files is based on the machine that has the GitLab runner running.
What's on your machine or anyone else's doesn't matter; Only the build server matters, so write your gitlab .yml accordingly.
Sample .net yml file
##variables:
## increase indentation carefully, one space per cascade level.
## THIS IS YAML. NEVER USE TABS.
stages:
- build
- deploy
#BUILD
# Builds all working branches
working:
stage: build
except:
- master
script:
- echo "Build Stage"
- echo "Restoring NuGet Packages..."
- '"c:\nuget\nuget.exe" restore "SOLUTION PATH"'
# - '"c:\nuget\nuget.exe" restore "ANOTHER ABSOLUTE PATH TO YOUR SOLUTION"'
- ''
- echo "Building Solutions..."
- C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet "SOLUTION PATH"
# Builds all stable/master pushes
stable:
stage: build
only:
- master
script:
- echo "Build Stage"
- echo "Restoring NuGet Packages..."
- '"c:\nuget\nuget.exe" restore "SOLUTION PATH"'
# - '"c:\nuget\nuget.exe" restore "ANOTHER ABSOLUTE PATH TO YOUR SOLUTION"'
- ''
- echo "Building Solutions..."
- C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet "SOLUTION PATH"
#DEPLOY
stage: deploy
only:
- dev
script:
- echo "Deploy Stage"
#SEND TO YOUR DEV SERVER
## deploy latest master to the correct servers
stage: deploy
script:
- echo "Deploy Stage"
only:
- master
#SEND TO YOUR PRODUCTION SERVER
tags:
- .NET
#put tags here you put on your runners so you can hit the right runners when you push your code.

Resources