uwp - 配置 azure devops 管道以打包和推送带有组件的 UWP 库
问题描述
我正在尝试使用 azure 管道将 UWP 库项目“发布”(构建、nuget 包和推送)到私有 azure 工件源。我在管道中使用经典编辑器,具有以下代理:
- Nuget 工具安装程序 - 指定 5.5.1
- Nuget - 恢复
- Visual Studio Build - vs2019,发布,任何 cpu
- Nuget - 包
- Nuget - 推
我可以成功打包 .csproj 文件,但是当我安装 nuget 包并使用库中的组件时,我收到此错误:
严重性代码 描述 项目文件行抑制状态错误 XDG0062 System.Reflection.TargetInvocationException:调用目标已引发异常。---> Windows.UI.Xaml.Markup.XamlParseException:XAML 解析失败。在 Windows.UI.Xaml.Application.LoadComponent(Object component, Uri resourceLocator, ComponentResourceLocation componentResourceLocation) 在 DeviceEnumerationAndPairing.Components.SerialDevicePicker..ctor() --- 内部异常堆栈跟踪结束 --- 在 System.RuntimeTypeHandle.CreateInstance( RuntimeType 类型,布尔公共 DevTest MainPage.xaml 14
我想我需要使用 .nuspec 来告诉 NuGet 包将组件的 .xaml 和 .xbf 文件复制到 .nupkg。我在 .nuspec 中输入了以下内容:
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata >
<id>myfeedname.DeviceEnumerationAndPairing</id>
<version>1.0.2</version>
<title>DeviceEnumerationAndPairing</title>
<authors>idldev</authors>
<owners>idldev</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Internal uwp library for device enumeration and pairing</description>
<releaseNotes>Development</releaseNotes>
<tags>device serial pairing idl idldev</tags>
</metadata >
<files>
<!-- WinMd and IntelliSense -->
<!-- XAML controls -->
<file src="..\DeviceEnumerationAndPairing\bin\Release\DeviceEnumerationAndPairing.XML" target="lib\uap10.0"/>
<file src="..\DeviceEnumerationAndPairing\obj\Release\embed\DeviceEnumerationAndPairing\Components\SerialDevicePicker.xbf" target="lib\uap10.0\Components"/>
<file src="..\DeviceEnumerationAndPairing\bin\Release\DeviceEnumerationAndPairing\Components\SerialDevicePicker.xaml" target="lib\uap10.0\Components"/>
<!-- DLLs and resources -->
<file src="..\DeviceEnumerationAndPairing\bin\Release\DeviceEnumerationAndPairing.dll" target="runtimes\win10-arm\native\DeviceEnumerationAndPairing.dll"/>
<file src="..\DeviceEnumerationAndPairing\bin\Release\DeviceEnumerationAndPairing.pri" target="runtimes\win10-arm\native\DeviceEnumerationAndPairing.pri"/>
<file src="..\DeviceEnumerationAndPairing\bin\Release\DeviceEnumerationAndPairing.dll" target="runtimes\win10-x64\native\DeviceEnumerationAndPairing.dll"/>
<file src="..\DeviceEnumerationAndPairing\bin\Release\DeviceEnumerationAndPairing.pri" target="runtimes\win10-x64\native\DeviceEnumerationAndPairing.pri"/>
<file src="..\DeviceEnumerationAndPairing\bin\Release\DeviceEnumerationAndPairing.dll" target="runtimes\win10-x86\native\DeviceEnumerationAndPairing.dll"/>
<file src="..\DeviceEnumerationAndPairing\bin\Release\DeviceEnumerationAndPairing.pri" target="runtimes\win10-x86\native\DeviceEnumerationAndPairing.pri"/>
</files>
</package>
..但是无论我指定仅使用 .nuspec,还是同时使用 .nuspec 和 .csproj - 在 'NuGet pack' 中,当我尝试安装 nuget 包时都会出现以下错误:
严重性代码 描述 项目文件行抑制状态错误 NU1202 包 idldev.DeviceEnumerationAndPairing 1.0.1-CI-20200421-150456 与 uap10.0.18362 不兼容(UAP,Version=v10.0.18362)。包 idldev.DeviceEnumerationAndPairing 1.0.1-CI-20200421-150456 不支持任何目标框架。
..对于win10-arm,win10-x86 ......
我认为我需要添加依赖项或 .target 文件?但我有点在黑暗中拍摄。我知道有一些类似问题的问题,所以希望这不是重复的,并且它是有道理的。任何帮助表示赞赏...
解决方案
您可以先检查以下提示:
any cpu
1.在您的第 3 步中,您在尝试为 win10-arm、win10-x86 选择程序集时使用模式构建解决方案......
与 VS 本地构建不同,管道中的 VS 构建任务不支持批量构建。因此,您需要使用不同的平台多次构建解决方案。
2.检查Package来自的源项目的目标框架。你应该确保包的目标框架支持你想要安装包的项目。(TargetPlatformVersion
和TargetPlatformMinVersion
)
3.检查是否生成了用于发布配置的xml文档。检查包项目的csproj文件,是否存在这一行?: <DocumentationFile>bin\Release\xxxx.XML</DocumentationFile>
4.这里有一份关于如何打包uwp包的详细文档。您可以参考它以获取更多详细信息。据此, XAML 文件应放入 Themes 文件夹。
推荐阅读
- entity-framework - 如何防止实体框架在数据库优先方法中将空字符串转换为 null
- python - 在 Flask 上注销时更改用户的布尔值
- c# - 从脚本返回值
- javascript - AWS Lambda /tmp 文件夹不在执行之间共享
- html - HTML表格不能改变文本的位置
- python - 如何将字典列表放入 Dataframe 的列中?
- reactjs - 限制儿童类型
- java - Java mail API on send mail where mail body应该有测试报告的摘要
- python-3.x - Python 和 Kivy:如何从内存中更新图像?
- elasticsearch - 如何在elasticsearch中获取文档的开始日期和结束日期字段之间的每一天的存储桶