You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a shared WinUI 3 class library project for some user controls, and added the shared project as a reference to the main project (unpackaged). It works fine when building and running from visual studio, or running from the bin folder. But after publishing the main project, the published app could not load those user controls anymore. A "XAML parsing failed" exception was thrown.
Looking into the content of the shared project dll in the publish folder, the user control looks for the xaml file like this:
/// <summary>
/// InitializeComponent()
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.UI.Xaml.Markup.Compiler"," 1.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void InitializeComponent()
{
if (_contentLoaded)
return;
_contentLoaded = true;
global::System.Uri resourceLocator = new global::System.Uri("ms-appx:///SharedProject/MyControl.xaml");
global::Microsoft.UI.Xaml.Application.LoadComponent(this, resourceLocator, global::Microsoft.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Nested);
}
This SharedProject/MyControl.xaml file exists in the bin folder but is not included in the publish folder. I could get the published app work by copying it over, but it's not a good idea to deliver raw code files to customers. Any suggestions?
The text was updated successfully, but these errors were encountered:
As reported in many other bugs you can't do it.
I know it is difficult to believe since this has been something you could do for 20+ years in other frameworks, but for now it does not work.
Thank you for pointing out the other reported bugs. Yes, it is difficult to believe this is something not in the plan yet... It is definitely an important feature that's supposed to be supported in any UI framework.
I created a shared WinUI 3 class library project for some user controls, and added the shared project as a reference to the main project (unpackaged). It works fine when building and running from visual studio, or running from the bin folder. But after publishing the main project, the published app could not load those user controls anymore. A "XAML parsing failed" exception was thrown.
Looking into the content of the shared project dll in the publish folder, the user control looks for the xaml file like this:
This SharedProject/MyControl.xaml file exists in the bin folder but is not included in the publish folder. I could get the published app work by copying it over, but it's not a good idea to deliver raw code files to customers. Any suggestions?
The text was updated successfully, but these errors were encountered: