With UseMaui = true in class library I get a '"CopyLocalFilesOutputGroup" does not exist' error
See original GitHub issueDescription
When I create a class library for reusable maui components and add <UseMaui>true</UseMaui>
to the csproj I get this error:
C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\6.0.300-rc.2.5513\Sdk\WinUI.NetCore.targets(188,5): error MSB4057: The target "CopyLocalFilesOutputGroup" does not exist in the project. C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\6.0.300-rc.2.5513\Sdk\WinUI.NetCore.targets
Used rc2 and VS preview 5
I am not sure if I am supposed to use <UseMaui>true</UseMaui>
for this purpose. I would like to know the alternative way if there is one. Still there may have to be a better error in this situation.
Screenshot of the situation:
Minimal reproduction: CopyLocalFilesOutputGroup-does-not-exist.zip
Steps to Reproduce
- Create a new maui app
- Create a new class library
- Add <UseMaui>true</UseMaui> to the csproj of the class library
- Add a reference to the class library in the maui app
- Compile.
Version with bug
Release Candidate 2
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
It is a compile problem so I guess it affects all platforms with RC 2. I compiled on Windows.
Did you find any workaround?
No
Relevant log output
Build started...
1>------ Build started: Project: ClassLibrary1, Configuration: Debug Any CPU ------
1>You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
1>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
1>ClassLibrary1 -> C:\Users\pauld\source\repos\MauiApp3\ClassLibrary1\bin\Debug\net6.0\ClassLibrary1.dll
2>------ Build started: Project: MauiApp3, Configuration: Debug Any CPU ------
2>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
2>MauiApp3 -> C:\Users\pauld\source\repos\MauiApp3\MauiApp3\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\MauiApp3.dll
2>C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\6.0.300-rc.2.5513\Sdk\WinUI.NetCore.targets(188,5): error MSB4057: The target "CopyLocalFilesOutputGroup" does not exist in the project. C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\6.0.300-rc.2.5513\Sdk\WinUI.NetCore.targets
2>Done building project "ClassLibrary1.csproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:42 (11 by maintainers)
Yeah. 😦 Windows errors are crazy hard to debug. Usually when this happens I check the C++ and CLR check boxes in the Exception Settings window - not perfect, but catches more exceptions (be warned WinUI throws a bit but you have to continue through as they are caught elsewhere):
At this moment I use:
these are settings in my Windows project. But still no succes, I am getting a little frustrated now. Everything worked till de Release Candidates.
When RC1 was released I had some problems but I fixed them. But since RC2 (when you think it should getting better) the project can not be build.