Search code examples
c#wpfuwpxaml-islands

How to fix Microsoft Store package validation error: You cannot submit pre-compiled .NET Native packages?


I'm developing a WPF application, I added a custom WinRT component (implemented in UWP) and I'm hosting this win10 component in the WPF app, via XamlHost. I followed every step of the documentation, my custom controls are implemented in a UWP app project instead of a UWP class library. The app runs well and the UWP components are displayed properly in the WPF application. I could create the app package, but when I uploaded to the Microsoft Store (the .msixupload file), the following error was thrown:

Package acceptance validation error: You cannot submit pre-compiled .NET Native packages. Please upload the Microsoft Store appxupload file and try again.

What they mean pre-compiled .NET Native packages?

I also checked the sample application, which contains a winrthost.dll for different architectures. However the documentation doesn't mention this, I also added to my UWP project and configured as it is in the sample app's .csproj file. I tried to remove this dll file, but the store still doesn't accept the build.

As I removed the reference to the UWP App project, the Store accepted my build. As I re-added the reference (without using any component from it), the Store rejected. So I think the problem is in the custom UWP app, but what could be a pre-compiled .NET Native package here?

Update:

I added a new empty UWP app project to the solution, just set up the XamlApplication and referenced it from the WPF application. The UWP component shows in the WPF (I added just a green rectangle), but when I tried to upload to the store, it displayed the same error message.

As the documentation says, also tried to create a UWP class library instead of the UWP app. Created the build and the store accepted... What is the difference?

The documentation says:

You can alternatively define the custom control in the UWP app project you created in the previous section. However, these steps do this in a separate class library project for illustrative purposes because this is typically how custom controls are implemented for portability.

So, theoretically it would be possible to publish a WPF app with a custom WinRT component hosted in a UWP app, right? Then why the store doesn't accepts?


Solution

  • After one day of investigation, I found that the solution is just to add the UWP app as a reference to the Packaging project (not just to the WPF app).

    As I added to the references, the Store accepted the build. More details here.