The PRIResource build action is needed by the .NET 5 project system, despite EnableDefaultItems being true by default, for resources to be added to the PRI on build. #15007
Labels
untriaged
Request triage from a team member
Visual Studio Version: VS 2019 Preview (Version 16.9.0 Preview 1.0)
Summary:
Despite
EnableDefaultItems
being true by default in the .NET 5 project system, the .csproj file of a WinUI3 Preview 3 project requires thePRIResource
build action for resources to be added to the PRI file on build.Steps to Reproduce:
Install WinUI3 Preview 3 per the instructions here: https://docs.microsoft.com/en-us/windows/apps/winui/winui3/#install-winui-3-preview-3
Create a new project using the "Class Library (WinUI in Desktop)" WinUI template (the same issue occurs with other WinUI3 Preview 3 templates, I'm just using this as an example).
Right click on the project in Solution Explorer. Select Add -> New Item... Select "Resources File (.resw)" in the list displayed. Add any value for the "String1" resource in the UI. Save the file.
Notice that the .csproj file now contains these two nodes:
and
Hit Build. Dump the PRI file that's generated using the following example command:
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64\makepri.exe' dump /if "<my_user_dir_path>\source\repos\ClassLibrary1\bin\Debug\net5.0-windows10.0.18362.0\ClassLibrary1.pri" /of "<my_user_dir_path>\source\repos\ClassLibrary1\bin\Debug\net5.0-windows10.0.18362.0\ClassLibrary1.pri.xml"
You'll see that the string that was added to the .resw file is present in the PRI dump.
Now, go to the .csproj file. Remove the
PRIResource
build action. Rebuild the project. Dump the PRI again.Expected Behavior:
PRI does contain string resources.
None
andPRIResource
should not be needed in the .csproj file sinceEnableDefaultItems
is true by default in the .NET 5 project system.Actual Behavior:
PRI does not contain string resources.
User Impact:
On migration from WinUI Preview 2 to Preview 3 (WinUI3 Preview 2 used pre .NET 4, and WinUI3 Preview 3 uses .NET 5), the user needs to manually add the
PRIResource
build action to the project file for the string resources to show up in the PRI. Before migration, aPRIResource
build action wasn't needed; after it is. Example: microsoft/microsoft-ui-xaml#3648The text was updated successfully, but these errors were encountered: