简体   繁体   中英

unable to publish UWP through WPF with XamlIslands : Microsoft.Windows.UI.Xaml.CSharp.targets not found

Good afternoon,

After following rigourously this XamlIslands tutorial from WDC , I've successfull been able to compile a test application thanks to.Net Core 3.0; the result you can see here

is the proof the tutorial is right: my application executes and runs fine in Debug mode.

Because I hope to deploy portable projects using UWP thanks to this technique, I tried to publish a.exe standalone file using this tutorial. The tutorial works for a .net Core 3 project, as long as I don't try to publish my cross-technology project.

When I try to publish the XamlIslands project, here is what the console says:

PS C:\Users\████████████\source\repos\TestCore> dotnet publish -r win-x64 -c Release
Microsoft (R) Build Engine version 16.3.0+0f4c62fea pour .NET Core
Copyright (C) Microsoft Corporation. Tous droits réservés.

C:\Users\████████████\source\repos\TestCore\MyUWPClass\MyUWPClass.csproj : warning NU1503: Ignorer la restauration du projet 'C:\Users\████████████\source\repos\TestCore\MyUWPClass\MyUWPClass.csproj'. Il est possible que le fichier projet ne soit pas valide ou qu'il ne contienne pas toutes les cibles nécessaires à la restauration. [C:\Users\████████████\source\repos\TestCore\TestCore.sln]
C:\Program Files\dotnet\sdk\3.0.100\NuGet.targets(123,5): warning : Projet à restaurer introuvable ! [C:\Users\████████████\source\repos\TestCore\TestCore.sln]
C:\Users\████████████\source\repos\TestCore\MyUWPClass\MyUWPClass.csproj(143,3): error MSB4019: Le projet importé "C:\Program Files\dotnet\sdk\3.0.100\Microsoft\WindowsXaml\v16.0\Microsoft.Windows.UI.Xaml.CSharp.targets" est introuvable. Vérifiez que le chemin d'accès dans la déclaration <Import> est correct et que le fichier existe sur le disque.

I've verified on the folder and the missing file, obviously, doesn't exist. In fact, the folder "...\WindowsXaml" doesn't even exist.

Q: Am I able to publish such a project, and if yes, which package am I missing?

Side notes:

  • I'm working with Visual Studio 2019 Enterprise Preview on Windows 10 v1903;
  • VS2019 Preview seems to disable publishing: clicking on "Generate => Publish TestCore" doesn't even open a window.
  • tried to install the .net Core 3 SDK: didn't helped;
  • tried to install the NuGet package Microsoft.NetCore.targets: didn't helped;
  • (EDIT) After building a trivial WPF application (Window + "Hello" label inside), right-click > Publish doesn't show anything but using the console command dotnet publish -r -win-x64 -c Release gave me a publish folder and a standalone application. Also tried to package on a single.exe file and it worked too.

I've figured out that if you have installed.Net Core 3.0 SDK/Runtime, and if you copy the folder your_project_folder/bin/x64/Debug/netcoreapp3.0/ , you will be able to run your_project.exe without publishing. It doesn't solve the publishing issue I had though, so the question stays opened.

The packaged documentation you provide is for the ConsoleApp. There is currently no documentation for the dotnet-CLI package WPF program.

When you publish a WPF program in Visual Studio, it will not pop up, but please pay attention to the contents of the " output " window, it will post package in your_project_folder/bin/x64/Debug/netcoreapp3.0/publish , where you can Find published apps and their dependencies.

Best regards.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM