-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
"Unable to find type" XAMLIL error message after deleting window from project #4968
Comments
I found something similar (although incorrectly reported it in the compiler repo) kekekeks/XamlX#37 |
Walkaround solution can be to delete compiled files with:
and rebuild the solution. |
This issue seems to appear fairly frequently lately and basically means that deleting XAML files without changing a line of code in a project will end up with this error. Also in my case forcing 20+ devs to wipe their repo and rebuild for 10 minutes is not the greatest option. @kekekeks Are you going to have time to investigate this sometime? |
That error means that XAML resource is still present in either Roslyn-generated assembly or GenerateAvaloniaResources target is supposed to be re-run when resource is deleted, but I guess MSBuild doesn't handle file deletion that well. |
Mkay, reproduced with much simpler project: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<Target Name="TestTarget"
BeforeTargets="CoreCompile;CoreResGen"
Inputs="@(MyResource);$(MSBuildAllProjects)"
Outputs="list.lst">
<WriteLinestoFile
File="list.lst"
Overwrite="True"
Lines="@(MyResource)"
/>
<Message Importance="high" Text="Files: @(MyResource)"/>
</Target>
<ItemGroup>
<MyResource Include="*.txt"/>
<UpToDateCheckInput Include="@(MyResource)" />
</ItemGroup>
</Project> When any of From my point of view that's clearly a bug in MSBuild, but I might be missing something. |
Perhaps we should report it to https://github.com/dotnet/msbuild? |
Found one random SO answer claiming that missing inputs won't invalidate targets: https://stackoverflow.com/a/48483825 |
Apparently that's by design and we are supposed to do the following:
An example of doing that is here https://github.com/Szer/GiraffeGenerator/blob/f488a4a0c693cc954557960da19015169e7f8f76/src/GiraffeGenerator.Sdk/build/GiraffeGenerator.Sdk.targets#L34-L46 |
MSBuild is doing the same for |
This is a weird one. Versions: AvaloniaUI 0.10.0-pre6, Avalonia for Visual Studio 0.9.11.0
Steps:
Try to compile the solution. An error message occurs: Unable to find type
AvaloniaApplication1.Window1
Line 1, Position 2.Grep the entire solution for Window1. No result.
Clean and rebuild the solution. The error persists.
Workaround I found:
Now everything compiles fine again.
The text was updated successfully, but these errors were encountered: