Skip to content
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

Resw aka Resources can't be Accessed Between WinUI Based Class Library Projects in Xaml #4310

Open
AathifMahir opened this issue Apr 5, 2024 · 4 comments
Labels

Comments

@AathifMahir
Copy link

Resw aka Resources can't be Accessed Between WinUI Based Class Library Projects in Xaml.

When Trying to Access Resources that Part of Main App Project with Xaml from a WinUI Based Class Library Which is Not Directly Dependent on Main Project Instead Main Project is Depended on that WinUI Based Class Library, it just doesn't Work and No Exception Whatsoever, If we try the Same by Using ResourceLoader in C#, It Just Works as Expected, I'm not sure this a bug or it's Intended Behavior

@ghost1372
Copy link
Contributor

You are doing wrong...
You can not use strings exist in Main Project in class library, but you can use class library strings resources in your Main App

@AathifMahir
Copy link
Author

AathifMahir commented Apr 6, 2024

You are doing wrong... You can not use strings exist in Main Project in class library, but you can use class library strings resources in your Main App

I'm looking for way to use strings from class library, but that doesn't work at all and the app doesn't pick up any resources when the resources were in class library but as an exception when we have exactly same resources in class library and app project, that fixes the issue. I'm not sure on how resource work anymore since resources are app wide not constraints to different projects, The Resources are App wide is True when we are accessing resources using ResourceLoader or ResourceMap in c# aka CodeBehind or Somewhere else. but doesn't work with Xaml

If i remember correctly, Previously on UWP having Packaging Project with Strings in it Fixes these kind of issues but Not on WinUI 3

@ghost1372
Copy link
Contributor

You are doing wrong... You can not use strings exist in Main Project in class library, but you can use class library strings resources in your Main App

I'm looking for way to use strings from class library, but that doesn't work at all and the app doesn't pick up any resources when the resources were in class library but as an exception when we have exactly same resources in class library and app project, that fixes the issue. I'm not sure on how resource work anymore since resources are app wide not constraints to different projects, The Resources are App wide is True when we are accessing resources using ResourceLoader or ResourceMap in c# aka CodeBehind or Somewhere else. but doesn't work with Xaml

If i remember correctly, Previously on UWP having Packaging Project with Strings in it Fixes these kind of issues but Not on WinUI 3

See here
https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/ResourceManagement/cs/cs-winui

@AathifMahir
Copy link
Author

AathifMahir commented Apr 15, 2024

You are doing wrong... You can not use strings exist in Main Project in class library, but you can use class library strings resources in your Main App

I'm looking for way to use strings from class library, but that doesn't work at all and the app doesn't pick up any resources when the resources were in class library but as an exception when we have exactly same resources in class library and app project, that fixes the issue. I'm not sure on how resource work anymore since resources are app wide not constraints to different projects, The Resources are App wide is True when we are accessing resources using ResourceLoader or ResourceMap in c# aka CodeBehind or Somewhere else. but doesn't work with Xaml

If i remember correctly, Previously on UWP having Packaging Project with Strings in it Fixes these kind of issues but Not on WinUI 3

See here
https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/ResourceManagement/cs/cs-winui

I tried example in the url, that also has same issue when using Xaml, with c# resources works perfectly but with Xaml I keep facing the same issue unless we have a resources.resw file that aligns with main resources.resw file and on that class library assembly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants