I am trying to 'publish' (build, nuget pack and push) a UWP library project to a private azure artifact feed using azure pipelines. I am using the classic editor in pipelines, with the following agents:
- Nuget tool installer - specify 5.5.1
- Nuget - restore
- Visual Studio Build - vs2019, release, any cpu
- Nuget - pack
- Nuget - push
I can successfully pack the .csproj file but when I install the nuget package and use a component from the library I get this error:
Severity Code Description Project File Line Suppression StateError XDG0062 System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Windows.UI.Xaml.Markup.XamlParseException: XAML parsing failed. at Windows.UI.Xaml.Application.LoadComponent(Object component, Uri resourceLocator, ComponentResourceLocation componentResourceLocation) at DeviceEnumerationAndPairing.Components.SerialDevicePicker..ctor() --- End of inner exception stack trace --- at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean public DevTest MainPage.xaml 14
I think I need to use a .nuspec to tell the NuGet pack to copy the component's .xaml and .xbf files to the .nupkg. I've entered the following into the .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>
..but whether I specify using just the .nuspec, or both the .nuspec and the .csproj - in the 'NuGet pack' , I get the following error when I try to install the nuget package:
Severity Code Description Project File Line Suppression StateError NU1202 Package idldev.DeviceEnumerationAndPairing 1.0.1-CI-20200421-150456 is not compatible with uap10.0.18362 (UAP,Version=v10.0.18362). Package idldev.DeviceEnumerationAndPairing 1.0.1-CI-20200421-150456 does not support any target frameworks.
..and for win10-arm, win10-x86...
I think that I need to add a dependency or a .target file? but I'm shooting in the dark a bit. I know there are some questions out there with similar issues, so hope this isn't a duplicate, and that it makes sense. Any help appreciated...