我们应该更新我们的文档。 与此同时,我们通常这样做:
在 VS 中构建您想要的项目风格,使用 MUXControlsTestApp 进行测试,然后当它看起来不错时,使用 build-nupkg.ps1 为该风格创建一个 nuget 包(为您刚刚构建的任何风格传递 BuildFlavor/BuildArch 参数)。 然后下游测试应用程序必须在同一个 buildarch 中构建。
@jevansaks我按照你提到的步骤构建了 Microsoft.UI.Xaml 的调试 x64 版本,然后执行build-nupkg.ps1
脚本来构建 nuget 包。
现在,当我将此 nuget 包添加到我自己的应用程序并构建它时,出现以下错误
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\Themes\rs3_compact_themeresources.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\Themes\rs4_generic.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\Themes\19h1_themeresources.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\Themes\rs4_compact_themeresources.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\DensityStyles\Compact.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\Themes\rs2_generic.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\Themes\rs3_generic.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\Themes\rs2_themeresources.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\Themes\rs2_compact_themeresources.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\Themes\rs5_compact_themeresources.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\DensityStyles\CompactDatePickerTimePickerFlyout.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\Themes\19h1_generic.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\Themes\rs4_themeresources.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\Themes\rs5_themeresources.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\Themes\19h1_compact_themeresources.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\Themes\rs5_generic.xbf' does not exist. TestXamlUI
Payload file 'C:\Users\user\.nuget\packages\microsoft.ui.xaml\2.3.0.28\runtimes\win10-x64\native\Microsoft.UI.Xaml\Themes\rs3_themeresources.xbf' does not exist. TestXamlUI
似乎文件夹DensityStyles
和Themes
不存在于 nuget 包的runtimes\win10-x64\native\Microsoft.UI.Xaml
文件夹中。
因此,我解压缩了 nuget 包并手动复制了这两个文件夹及其内容(来自BuildOutput\Debug\x64\Microsoft.UI.Xaml
)。 然后我再次压缩它并将其重命名为 .nupkg。
然后它正常工作。
build-nupkg.ps1
脚本中是否缺少任何由于未复制两个文件夹而导致的内容?
哦,我现在记得,在调试版本中对 F5 时间有一个新的 VS 优化,这使得调试版本中的 .pri 文件在默认情况下不适用于 nuget 包。 您可以构建发布并使用它,也可以将 vcxproj 中的此设置更改为 false 以进行调试: