I'm trying to build some UWP libraries and I receive this error:
D:\a\ZXing.Net.Xamarin\ZXing.Net.Xamarin\Source\ZXing.Net.Mobile.WindowsUniversal\ZXing.Net.Mobile.WindowsUniversal.csproj(155,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v11.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
The import clause in the .csproj file looks like this:
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
So I've tried to install the UWP workload programatically in the Windows2019 VM via chocolatey (both with this package and this other; not the Windows10SDK one because it gives an error when trying to install) with:
- run: |
choco install visualstudio2019-workload-universal
choco install visualstudio2019-workload-universalbuildtools
But this doesn't seem to cut it (the package gets installed successfully, apparently) because I still keep getting that compilation error.
Also tried including optional packages, to no avail:
choco install visualstudio2019-workload-universal --package-parameters "--includeOptional"
UPDATE: Turns out that my CI VM already had the file Microsoft.Windows.UI.Xaml.CSharp.targets
, but it was located in C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\WindowsXaml\v16.0
(and other versions of it in subfolders underneath this one). For more details, look at my answer.