我正在使用VSTS中的"Azure Web App部署"构建步骤将ASP.NET Core API发布到Azure Web App:
有时,此步骤会出现以下错误:
[error] Microsoft.Web.Deployment.DeploymentDetailedClientServerException:Web Deploy无法修改目标上的文件"MyProject.Api.exe",因为它已被外部进程锁定.为了使发布操作成功,您可能需要重新启动应用程序以释放锁定,或者在下次发布尝试时使用.Net应用程序的AppOffline规则处理程序.有关详情,请访问:http: //go.microsoft.com/fwlink/?LinkId = 221672 #ERROR_FILE_IN_USE.
此GitHub问题引发了同样的问题,但没有使用Azure Web App部署构建步骤的建议解决方案.
azure azure-web-sites azure-devops azure-pipelines-build-task azure-pipelines
是的,我知道.NET Core 3.0仍在预览中。我想在Azure Pipelines上构建它。
是否有捷径可寻?
当前出现此错误:
/usr/share/dotnet/sdk/2.2.105/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(137,5):错误NETSDK1045:当前的.NET SDK不支持目标.NET核心3.0。目标.NET Core 2.2或更低版本,或使用支持.NET Core 3.0的.NET SDK版本。
编辑
我找到了有关此的官方文档:
https://docs.microsoft.com/zh-cn/azure/devops/pipelines/languages/dotnet-core?view=azure-devops
我有一个服务连接,用于 Azure DevOps 中的管道。它是由另一位用户不久前创建的。最近它过期了,不允许我更改与之关联的用户名。因此,我删除了该服务连接并创建了一个新的连接,我花了很多时间来修改使用它的每个管道。
我有两个问题。
是否可以更改服务连接的创建者名称?
如果没有,是否有其他方法可以在其机密过期后重用现有的服务连接?
提前致谢。
我越来越
无法为'.NETStandard,Version = v2.0'解析'NETStandard.Library(> = 1.6.1)'.
在我将aspnetcore应用程序升级到netcoreapp2.0我的库并使用之后,使用Hosted2017构建代理构建VSTS netstandard2.0.
在当地工作正常.
我编辑了我的构建定义以使用.net核心构建任务v2.* preview:
这是构建日志:
Current agent version: '2.120.2'
Download all required tasks.
Downloading task: DotNetCoreCLI
Starting: Get Sources
Syncing repository: Liero/vyvojari-sk (GitHub)
...details ommited
HEAD is now at e448a25... Upgraded to .NET Core 2.0
Finishing: Get Sources
Starting: Restore
==============================================================================
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated …Run Code Online (Sandbox Code Playgroud) .net-core azure-devops azure-pipelines .net-core-2.0 .net-standard-2.0
我有一些测试自动化代码从存储在本地机器上的环境变量中读取一些值,如下所示:
Environment.GetEnvironmentVariable("SAUCE_USERNAME", EnvironmentVariableTarget.User);
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用 Azure Pipelines 在管道执行期间创建此变量,然后在我的测试自动化代码中读取它。使用 YAML 文件。
我在 Azure Pipeline 的 VS 测试步骤中读取此变量。因此,如果我设置该变量,它必须在 Azure Pipeline 的整个生命周期内。
也尝试了下面的代码,但由于此错误而失败:
azure-pipelines.yml (Line: 39, Col: 1, Idx: 1252) - (Line: 39, Col: 1, Idx: 1252):扫描一个简单的键时,找不到预期的':'。
# Create a secret variable
- powershell: |
Write-Host '##vso[task.setvariable variable=sauce.userName;issecret=true]abc'
# Attempt to output the value in various ways
- powershell: |
# Using an input-macro:
Write-Host "This works: $(sauce.userName)"
# Using the env var directly:
Write-Host "This does not work: …Run Code Online (Sandbox Code Playgroud) continuous-integration azure azure-devops azure-pipelines-build-task azure-pipelines
我无法让我的代码覆盖率报告工作,或者更确切地说,让 DevOps 正确传递我的参数。如果我下载构建目录(在构建中压缩),则 ReportGenerator 报告可用,但不会发布。所以我知道这部分至少在起作用。:)
但是,当发布步骤运行时,它会创建新报告并使用这些报告。我的Yaml文件如下:
## Generate Reports
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
displayName: Generate Code Coverage Reports
inputs:
reports: '**\coverage.cobertura.xml'
targetdir: 'results'
reporttypes: 'HTML;HtmlInline_AzurePipelines;Badges;Cobertura'
assemblyfilters: '-*tests*'
continueOnError: true
# Publish Code Coverage Reports
- task: PublishCodeCoverageResults@1
displayName: Publish Code Coverage Results
inputs:
disable.coverage.autogenerate: true
summaryFileLocation: $(Build.SourcesDirectory)\results\cobertura.xml
reportDirectory: $(Build.SourcesDirectory)\results
codecoverageTool: cobertura
continueOnError: true
Run Code Online (Sandbox Code Playgroud)
但是,当我在 Debug 中运行时,我得到以下输出:
##[debug]disable.coverage.autogenerate=undefined
Run Code Online (Sandbox Code Playgroud)
我尝试了以下选项来传递此参数:
disable.coverage.autogenerate: true
disable.coverage.autogenerate: 'true'
disable.coverage.autogenerate: 1
Run Code Online (Sandbox Code Playgroud)
他们都没有成功地将任何东西传递给任务。
如果没有设置此标志,任务将覆盖 ReportGenerator 生成的 HTML 报告并输出以下内容:
##[warning]Ignoring coverage report directory with Html content as we are auto-generating …Run Code Online (Sandbox Code Playgroud) .Net Core 3.1 发布很棒,但我不确定 Azure Pipelines 托管代理是否已经赶上。
我的 YAML 管道指定:
pool:
vmImage: 'windows-latest'
Run Code Online (Sandbox Code Playgroud)
该dotnet restore步骤执行以下操作:
(_CheckForUnsupportedNETCoreVersion 目标) -> C:\Program Files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(127,5): 错误 NETSDK1045: 当前的 .NET SDK 不支持面向 .NET Core 3.1。以 .NET Core 3.0 或更低版本为目标,或使用支持 .NET Core 3.1 的 .NET SDK 版本。[D:\a\1\s\StatsNZ.BESt.DataService\StatsNZ.BESt.DataService.csproj]
在 .Net Core 3.0 中工作正常。
是否有任何变通办法,或者我们是否必须等待 Azure DevOps 迎头赶上?
我正在 yaml 中构建一个复杂的管道,并尝试在两个作业之间创建依赖关系,以便后一个作业在前一个作业之后运行,但前提是前者设置为基于参数运行。我似乎无法弄清楚这是否可行。
我有一个这样定义的管道:
parameters:
- name: doJobA
type: boolean
stages:
jobs:
- job: JobA
condition: eq('${{ parameters.doJobA }}', true)
# ... details removed for brevity
- job: JobB
dependsOn: JobA
# ... details removed for brevity
Run Code Online (Sandbox Code Playgroud)
JobB应该在JobAifparameters.doJobA为 true 后运行,或者如果parameters.doJobA为 false 则立即运行。如果不满足条件,简单地添加dependsOn条件就会导致跳过,这是有道理的,但我希望它无论如何都能运行。JobBJobA
dependsOn是否可以以这种方式定义条件?
编辑:我遇到了一个额外的问题,导致下面的解决方案无法使用。我需要条件依赖于先前运行的 PowerShell 脚本设置的变量,而不是基于参数。
我刚刚使用 YAML 文件创建了一个管道,但总是收到错误“/_Azure-Pipelines/templates/webpart.yml: (Line: 41, Col: 27, Idx: 1058) - (Line: 41, Col: 60) ,Idx:1091):解析块映射时,未找到预期的键。”。我已经验证了 YAML 文件的缩进,看起来不错。
下面是我的 YAML 文件。
parameters:
- name: azureSubscription
type: string
- name: cdnStorageAccount
type: string
- name: cdnResourceGroupName
type: string
- name: cdnEndpointName
type: string
- name: cdnProfileName
type: string
- name: sourceBranchTrigger
type: string
stages:
- stage: build_stage
displayName: "Build"
jobs:
- job: build_job
steps:
- task: UseNode@1
displayName: "Use Node 8.x"
inputs:
version: "8.x"
- task: CmdLine@2
displayName: "Build"
inputs:
script: | …Run Code Online (Sandbox Code Playgroud) 我已经为我的 github 存储库之一设置了 azure 管道。除了构建状态徽章外,一切都完美无缺。它没有正确显示,似乎无法加载图像。
目前正在显示:
markdown 文件中使用的代码由 azure devops 自动生成
[](https://dev.azure.com/larsbehl/larsbehl/_build/latest?definitionId=1&branchName=master)
Run Code Online (Sandbox Code Playgroud)