azure - 当我将 WPF 4.72 应用添加到我的解决方案时,为什么我的 Azure Build 会中断?
问题描述
环境:
Web API .Net Core 3.1
WPF 4.72
Wix 3.1.2
Visual Studio 2019 Pro ed。
以下是我的 Wix 安装程序和我的 Web API 项目的构建脚本:
trigger:
- master
pool: 'TakeKidsToPool'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@0
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: DotNetCoreCLI@2
displayName: Publish API
inputs:
command: publish
publishWebProjects: false
arguments: /p:PublishProfile=FolderProfile -c $(buildConfiguration)
zipAfterPublish: false
modifyOutputPath: false
- task: MSBuild@1
displayName: Create API msi
inputs:
solution: SetupProject1/*.wixproj
msbuildArchitecture: x64
configuration: $(buildConfiguration)
当我将 WPF 项目添加到解决方案并且甚至不更改构建脚本时,它在发布部分失败,这与 WPF 项目无关。我不明白。
Determining projects to restore...
Restored C:\agent2\_work\10\s\WebApplication1\WebApplication1.csproj (in 891 ms).
C:\Program Files\dotnet\sdk\3.1.402\Microsoft.Common.CurrentVersion.targets(1177,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.7.2 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [C:\agent2\_work\10\s\WpfApp1\WpfApp1.csproj]
WebApplication1 -> C:\agent2\_work\10\s\WebApplication1\bin\Release\netcoreapp3.1\win-x64\WebApplication1.dll
WebApplication1 -> C:\agent2\_work\10\s\WebApplication1\bin\Release\netcoreapp3.1\win-x64\publish\
##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
##[error]Dotnet command failed with non-zero exit code on the following projects :
##[section]Finishing: Publish API
下面是发布配置文件,它是构建脚本中的一个参数:
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DeleteExistingFiles>False</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\netcoreapp3.1\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishSingleFile>True</PublishSingleFile>
<ProjectGuid>5c246494-0b84-4e8b-943b-e13381b8fb83</ProjectGuid>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>
解决方案
如果我们使用自托管代理,我们需要在本地机器上配置环境。根据报错信息,您的代理机器似乎没有.NETFramework 4.7.2,我们应该安装.NET Framework 4.7.2并重新启动代理。
推荐阅读
- java - Docker docker-compose 无法访问 Dockerfile 中指定的 jarfile
- django - 如何为 ManyToManyField 使用 Django DRF 序列化程序
- php - PHP 问题 - 收到警告说明:mysqli_num_rows() 期望参数 1 为 mysqli_result
- time-complexity - 带条件的嵌套循环的渐近分析(j=i+1)
- fancytree - fancytree - 更新子节点的数据并将其发回
- string - 有没有一种有效的方法可以在谷歌应用程序脚本的一列单元格中搜索和附加字符串?
- javascript - vue-btn doesn't submit on enter key
- ldap - DN中有特殊字符时,无法正常添加用户到AD
- python - 为什么我在使用 python shell 时不能使用 tkinter 窗口
- sql - 在 Oracle 全局临时表中放置什么