按照此 Microsoft教程(使用您的构建运行单元测试),我希望能够在触发构建(例如 Pull 请求)时自动运行单元测试。
但是,当我查看“管道/构建”选项卡并尝试编辑我的管道时,没有任何内容允许我添加新任务(请参见下面的屏幕截图)。

但是,似乎没有任何添加任务的方法。如果不通过 Repo 导航到源,我什至无法切换到 YMAL。我希望使用 GUI,因为我的 YMAL 不存在。
我创建了一个具有以下结构的测试解决方案,该解决方案保存在存储库中:
Core Solution
|_ Class Library Project (.NET Core)
|_ MSTest Test Project (.NET Core)
Run Code Online (Sandbox Code Playgroud)
我希望在构建步骤后使用我的MSTest 测试项目 (.NET Core)项目中的测试进行单元测试步骤。
顺便说一句, “发布”选项卡中似乎有一个“任务”选项,但我希望也能够为构建添加任务,尤其是单元测试。
作为新手,也许我错过或误解了一些东西。我将不胜感激任何帮助并指出正确的方向。
我正在使用 Visual Studio Build In Azure Pipeline 构建 C# 应用程序。
我的解决方案包含多个项目(ManagerWeb 和 WebAPI)。
我想分别发布两个单独的 Artifact ManagerWeb 和 WebAPI。
所有必需的文件都存在于Build.ArtifactStagingDirectory.
我如何指定一个模式,使用它可以获得两个单独的工件?WebAPI示例第一个工件和ManagerWeb另一个工件中的所有文件名。
ArtifactStaging 目录中的文件名如下
Something.Manager.WebAPI.deploy.cmd
Something.Manager.WebAPI.deploy-readme.txt
Something.Manager.WebAPI.SetParameters.xml
Something.Manager.WebAPI.SourceManifest.xml
Something.Manager.WebAPI.zip
Something.ManagerWeb.deploy.cmd
Something.ManagerWeb.deploy-readme.txt
Something.ManagerWeb.SetParameters.xml
Something.ManagerWeb.SourceManifest.xml
Something.ManagerWeb.zip
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激。
提前致谢。
c# azure-devops azure-pipelines-build-task azure-pipelines azure-artifacts
在 DevOps 中,您可以创建一个dotnet build任务,其中可以设置“项目路径”**/*.csproj来构建所有项目。
这工作得很好,但它(显然)也构建了我的*.Test.csproj项目。
我发现一些帖子提到了排除模式,因此我尝试执行与这些帖子中相同的操作,并尝试了以下组合:
**/*.csproj;-**/*.Test.csproj
**/*.csproj;!**/*.Test.csproj
**/*.csproj;-:**/*.Test.csproj
**/*.csproj;!:**/*.Test.csproj
Run Code Online (Sandbox Code Playgroud)
对于所有尝试,我都会在 DevOps 日志中收到以下错误:
未找到与指定模式匹配的项目文件。
那么,如何创建一个dotnet build任务来构建除项目之外的所有项目呢*.Test.csproj?
.net-core azure-devops azure-pipelines-build-task azure-pipelines
根据此处的文档运行 Azure PowerShell 任务时,我在 Azure DevOps Pipelines 中看到此错误:
错误
术语“d:\a\1\s”不被识别为 cmdlet、函数、脚本文件或可操作程序的名称。检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。
我的管道 YAML 如下所示。
- task: AzurePowerShell@4
inputs:
azureSubscription: $(azureSub)
inline: 'New-AzResourceGroupDeployment -ResourceGroupName $(azureBroadsideResourceGroup) -TemplateFile .\build\arm-template_broadside-resources.json'
errorActionPreference: 'stop'
failOnStandardError: true
azurePowerShellVersion: 'latestVersion'
#scriptType: 'inlineScript' # Optional. Options: filePath, inlineScript
#scriptArguments: # Optional
#scriptPath: # Optional
#preferredAzurePowerShellVersion: # Required when azurePowerShellVersion == OtherVersion
Run Code Online (Sandbox Code Playgroud)
任务的完整输出如下所示。
##[section]Starting: AzurePowerShell
==============================================================================
Task : Azure PowerShell
Description : Run a PowerShell script within an Azure environment
Version : 4.154.5
Author : Microsoft Corporation
Help : …Run Code Online (Sandbox Code Playgroud) 我在使用 Azure DevOps Pipeline 部署一次性项目时遇到错误。我不明白我的错误在哪里。
首先,我可以从 Visual Studio 手动构建和发布我的单击一次应用程序。我没有问题。当我使用 Azure DevOps Pipeline 构建和发布单击一次应用程序时,出现错误:
[错误]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(780,5):错误:未为项目'设置OutputPath属性******.vbproj'。请检查以确保您为此项目指定了有效的配置和平台组合。配置='发布'平台='任何CPU'。您可能会看到此消息,因为您正在尝试构建没有解决方案文件的项目,并且指定了该项目不存在的非默认配置或平台。
未为项目设置 OutputPath 属性。嗯,我不知道。让我给你我的项目文件:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{****}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>****.*****4</RootNamespace>
<AssemblyName>****.*****4</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<IsWebBootstrapper>true</IsWebBootstrapper>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
<PublishFilePath>$(PublishDir)install*****4.html</PublishFilePath>
<PublishUrl>\\server15\c%24\inetpub\wwwroot\*****4Install %28Staging%29\</PublishUrl>
<Install>true</Install>
<InstallFrom>Web</InstallFrom>
<UpdateEnabled>true</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>true</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<InstallUrl>http://*****4install-staging.newsprintgroup.com/</InstallUrl>
<ProductName>***** Application</ProductName>
<PublisherName>NewsPrint Group</PublisherName>
<MinimumRequiredVersion>4.15.0.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>install*****4.html</WebPage> …Run Code Online (Sandbox Code Playgroud) 我有一个包含两个作业(job: Publish和deployment: Deploy)的 Azure Pipelines 阶段。
有时作业在完成deployment: Deploy之前就开始运行job: Publish。
我收到错误,然后我需要等待job: Publish完成并重新运行deployment: Deploy。
当我重新运行时deployment: Deploy一切顺利......
问题
为什么deployment: Deploy先开始后job: Publish结束?
这是该阶段的 YML 代码:
- stage: Production
dependsOn: Staging
jobs:
- job: Publish
pool:
vmImage: 'Ubuntu 16.04'
steps:
- task: UseDotNet@2
displayName: Setup
inputs:
packageType: sdk
version: 3.0.x
- task: DotNetCoreCLI@2
displayName: Publish
inputs:
command: publish
publishWebProjects: false
projects: 'src/**/*.csproj'
arguments: '--configuration production --output $(Build.ArtifactStagingDirectory)' …Run Code Online (Sandbox Code Playgroud) 如何在管道开始处插入新阶段,或者只是重新排序现有阶段。当我单击“添加”时,它会将其放在第二阶段下方,但我不知道如何将其放在前面。
请注意,这不是一个版本。这是我正在编辑的管道。
如果您知道如何编辑 yaml 文件,我会很高兴,我认为该文件就在某个地方。我现在所拥有的似乎就是这个可视化界面
我们使用 Microsoft Azure Pipelines 为 ios 和 android 构建 Ionic 应用程序。不幸的是,我们在构建 android 应用程序时遇到以下错误。
FAILURE: Build failed with an exception.
* Where:
Build file '/home/vsts/work/1/s/android/capacitor-cordova-android-plugins/build.gradle' line: 21
* What went wrong:
Could not compile build file '/home/vsts/work/1/s/android/capacitor-cordova-android-plugins/build.gradle'.
> startup failed:
build file '/home/vsts/work/1/s/android/capacitor-cordova-android-plugins/build.gradle': 21: unable to resolve class targetSdkVersion
@ line 21, column 26.
targetSdkVersion targetSdkVersion = project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 29
Run Code Online (Sandbox Code Playgroud)
奇怪的是,几天前它没有任何问题地工作。用于生成 APK 的命令
sudo npx jetify
sudo ionic capacitor sync android
cd android && gradle wrapper && sudo ./gradlew …Run Code Online (Sandbox Code Playgroud)