Closed jindal1979 closed 2 years ago
Hello 👋
First of all, thank you for your interest in this project. Always nice to see that there actually are people having a look into it. :)
Concerning your question: From my perspective this project already supports .Net 6 and .Net MAUI. This project targets .Net Standard 2.0 and as such it is compatible for consumption in .Net 6 projects.
As I haven't tried it until recently I wasn't 100 % sure whether this project supports .Net MAUI. Hence, I just now created a minimalistic sample. Please have a look into:
Besides adding the Resx files in Resources\Localization
these are the only files which I adjusted from the official MAUI template sample. It's very prototypical and I would do some refactoring for real world projects. However, as a proof of concept it should be sufficient. At least now I am very sure that this project supports MAUI to the same extent as WPF.
Therefore, I don't see a necessity for adjustments in order to support .Net 6 and .Net MAUI. But maybe I am missing something? In that case would you be so kind to elaborate?
Thanks for your reply and sharing the repo for MAUI. I am facing issue that in my project it is not generating the source code from resx files. I am not sure what is the reason.
When I use in small project, it generates, however in my full project it doesn't.
Is there any specific settings for it to generate source ?
There is no special settings.
But using SourceGenerators requires your codebase to be build with a .Net 5.0 SDK or higher. It's a bit paradox, because SourceGenerator projects can target .Net Standard 2.0 the IDE won't make sure that no lower SDK is used. Please make sure that the bigger project is using an SDK which is compatible.
Then you need .resx files in your project:
Then just reference the most current version of MrMeeseeks.ResXToViewModelGenerator via nuget. This would look like that in your .csproj:
<ItemGroup>
<PackageReference Include="MrMeeseeks.ResXToViewModelGenerator" Version="69.0.33" />
</ItemGroup>
It is important that you do that in the same project where the .resx files are located. Otherwise, it won't generate anything. At that point it may be necessary to restart the IDE.
Then you should see the generated code - if you are using Visual Studio - here:
An alternative way of outputting the generated code is by using following settings in you .csproj:
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GeneratedFiles</CompilerGeneratedFilesOutputPath>
Then you should see the generated code here:
Please make sure that the keys inside the .resx files have no special characters. MrMeeseeks.ResXToViewModelGenerator uses the keys as C#-property identifiers and therefore there are not all characters allowed. Ideally the keys should have no characters which aren't allowed in identifiers of properties in C#.
If it still doesn't work I think the last resort is to compare the small project that you got running and the big project where it doesn't work yet and try to make out what the crucial difference is.
I hope that helps,
Thanks for sharing the detailed information. Its working for me !!!
Nice. I'm glad that I could help. :)
It would be good to get support for .NET 6 and .NET MAUI. Is there a plan to support these ?