-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WPF doesn't compile with ProjectReunion #593
Comments
Microsoft.ProjectReunion.Foundation is not designed to be used standalone. It doesn't include the implementation. You should use Microsoft.ProjectReunion instead. |
@huichen123 But that brings in WinUI right? WinUI is not compatible with WPF in this context. How does one use MRT without bringing in WinUI? |
unfortunately there is no ala carte support at this moment. maybe remove WinUI from microsoft.projectreunion.nuspec in the nuget cache. |
Exactly what @riverar said. |
you want to file a new issue to not include WinUI. For your compile issue, you can work around by adding this to your csproj. But it won't let you run.
|
Hm. @andrewleader @jonwis Is there any scheduled a la carte work? I don't see any, which means we're going to miss 0.5 release right? (The README currently states Reunion bits are |
@riverar if by The only time it's a burden is on download sizes if you choose to carry the Reunion packages within your own download (which you'd do if you need to support offline installs). But that impact is only at download-time and doesn't impact the installed size of your app. The |
@andrewleader will this always be the case? |
But it's 4 nuget packages with what seems to be an odd cyclic dependency. Could we get that all cleaned up? |
@mrlacey @dotMorten there is currently no plan to move away from only using one single framework package to distribute all of Project Reunion. And the 4 NuGet packages can't be used independently, it's just an implementation detail that there's 3 sub-packages. I'd love to know what you ideally would want and why (and WinUI 3 breaking WPF XAML is an example of a bug, not a reason to ship separately). It may be worth one of you creating a new discussion in the Discussions tab to continue discussing this further (rather than taking over this bug's thread). Really appreciate the feedback! |
Fixed in next servicing release (also include changes in internal repo). |
@andrewleader If I'm building a WPF app and want to use MRTCore, I automatically get all the WinUI APIs. Which means I now have several duplicate classes (in different namespaces), and it gets confusing to constantly trying to resolve a class name and picking the right namespace. I'd never want to resolve to a WinUI or WinRT class, so it's better if I can avoid just referencing that assembly completely, as I would never ever use it. I get you're saying the package gets installed anyway, and that's fine, but I don't want it referenced in my project to keep things clean and easy to work with. It's also about telling a clean story with any class libraries we build - my class library could clearly state that it takes just a dependency on MRTCore, and doesn't depend on any WinUI components, but is completely stand-alone. |
Servicing release |
@andrewleader Yup! Compiles now. Still hitting a few issues though trying to use the resource manager (and it only returns the resources from the package project and not the app), but closer at least :-) Microsoft.ApplicationModel.Resources.ResourceManager rm
= new Microsoft.ApplicationModel.Resources.ResourceManager();
for(uint i = 0;i< rm.MainResourceMap.ResourceCount; i++)
{
var value = rm.MainResourceMap.GetValueByIndex(i);
}
var val = rm.MainResourceMap.GetValue(@"Files/Images/LockScreenLogo.png");
byte[] bytes = val.ValueAsBytes; // Crashes !
var qualifiers = val.QualifierValues.ToArray(); // Crashes ! |
@dotMorten in your csproj, you need to switch the PackageReference from "Microsoft.ProjectReunion.Foundation" to "Microsoft.ProjectReunion". In your wapproj, also add a PackageReferene to "Microsoft.ProjectReunion". |
@huichen123 Yes I already did that |
@dotMorten i c. unless you embedded the png in PRI file, you will get a file path, thus you need to use ValueAsString to get the path instead of ValueAsBytes. |
@huichen123 Got it! Works great: The crash is pretty unhelpful though. Would be nice getting an error that actually told me what I did wrong: |
the hresult it throws is 0x80073b0d, which is ERROR_MRM_RESOURCE_TYPE_MISMATCH. hopefully that gives you some clue. |
Describe the bug
I was trying to use MRTCore that is in ProjectReunion with a WPF application. But merely referencing the package breaks the build.
Steps to reproduce the bug
Or use this repro sample:
App35.zip
If compiling from commandline instead of from within VS, the error is slightly different:
Expected behavior
Application builds.
Version Info
.NET: 5.0.201
VS: 16.9.1
NuGet package version:
Microsoft.ProjectReunion.Foundation 0.5.0-prerelease
Additional context
The text was updated successfully, but these errors were encountered: