gpt4 book ai didi

azure-devops - 使用 Azure DevOps CICD 管道将旧版 .net 框架控制台应用程序部署到本地服务器

转载 作者:行者123 更新时间:2023-12-04 04:22:41 25 4
gpt4 key购买 nike

我是 DevOps 和 CICD 管道的新手。
我使用 Azure DevOps CICD 管道成功地将 ASP .NET MVC 网站部署到我使用 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.



应用程序内置于 3.5 到 4.5 等遗留框架中,因此不是 .net 核心应用程序。
我发现了很多在线文章,这些文章演示了在 azure 上部署 webjobs 或者可能适用于 onprem,但是否适用于旧的控制台应用程序?

我尝试在 Framework 4.7 中构建一个非常简单的控制台应用程序,并尝试部署/复制/发布到我的本地机器的共享路径。授予正在运行但复制文件和发布工件任务失败的 VSTS 代理服务的权限。我尝试在 CI 和 CD 管道中都这样做,但都失败了。

请查看管道和日志 并建议我哪里做错了或者有其他选择吗?
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 管道 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 管道 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

enter image description here

Deployment group - machine

最佳答案

如果您为您的代理使用代理池“Azure Pipelines”,部署将发生在一台对您的本地机器一无所知的 azure 云机器上。

enter image description here

您应该在本地安装一个自托管代理并将其链接到您的 DevOps 并将其用于代理。

https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops

关于azure-devops - 使用 Azure DevOps CICD 管道将旧版 .net 框架控制台应用程序部署到本地服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58704918/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com