I am new to DevOps and CICD pipelines.
I successfully deployed ASP .NET MVC website using Azure DevOps CICD pipeline to my onprem agent/machine using Azure DevOps.
Similarly I want to deploy a console application which can be ultimately used as scheduled job in windows 'Task Scheduler' or either as a 'Windows Service'. Right now I am managing these deployments manually but after seeing the power of DevOps I hope, there could be really some automated solution for console apps as well.
The applications are built in legacy framework like 3.5 to 4.5, so not .net core apps. I found lot of online articles which demonstrates deploying webjobs on azure or may be possible for onprem but is it possible for old console apps?
I tried to build a very simple console app in Framework 4.7 and tried to deploy/copy/publish to my onprem machine's shared path. Gave permission to VSTS agent services which are running but copy files and publish artifact tasks are failing. I tried to do it in both CI and CD pipelines but all are failing.
Please review the pipelines and logs and suggest where I am doing wrong or there are any alternatives?
https://dev.azure.com/MSTCsandippatel/DemoConsoleApp
2019-11-05T05:03:52.8436105Z ##[error]Publishing build artifacts failed with an error: Unable to create directory '\MAHANTAM\Azure Artifacts\DemoConsoleApp'. Unable to verify the directory exists: '\MAHANTAM\Azure Artifacts\DemoConsoleApp'. If directory is a file share, please verify the share name is correct, the share is online, and the current process has permission to access the share.
CI pipeline 1
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=True /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'DemoConsoleApp'
publishLocation: 'Container'
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=True /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'DemoConsoleApp'
publishLocation: 'Container'
CI pipeline 2
pool:
name: Azure Pipelines
demands:
- msbuild
- visualstudio
steps:
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'
vstsFeed: '622d44e2-69d4-4d42-bb91-9d6ddd97f9ba/8eaf9077-829d-4567-93c0-8e0d7973634b'
- task: VSBuild@1
displayName: 'Build solution **\*.sln'
inputs:
solution: '$(Parameters.solution)'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: PublishSymbols@2
displayName: 'Publish symbols path'
inputs:
SearchPattern: '**\bin\**\*.pdb'
PublishSymbols: false
continueOnError: true
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(system.defaultworkingdirectory)'
Contents: '**\bin\$(BuildConfiguration)\**'
TargetFolder: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
- task: CopyFiles@2
displayName: 'Copy Files Task'
inputs:
SourceFolder: '$(system.defaultworkingdirectory)'
Contents: '**/**'
TargetFolder: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
- task: ArchiveFiles@2
displayName: 'Archive $(Build.BinariesDirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: DemoConsoleApp'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: DemoConsoleApp