AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
26.05k stars 2.25k forks source link

[0.10.10] No precompiled XAML found for .App #6924

Closed perfectdev closed 2 years ago

perfectdev commented 3 years ago

I can't find a working solution to fix this bug. It plays only on Windows when trying to run the project (but the build succeeds).

PS: On MacOSX and Linux the problem does not manifest itself. PPS: Changing the resource type on axaml-files does not solve the problem.

Avalonia.Markup.Xaml.XamlLoadException: No precompiled XAML found for XXX.App, make sure to specify x:Class and include your XAML file as AvaloniaResource
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Object obj) in /_/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoader.cs:line 26
   at XXX.App.Initialize() in C:\Users\user\Documents\Sources\XXX\XXX\App.axaml.cs:line 20
   at Avalonia.Controls.AppBuilderBase`1.Setup() in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 310
   at Avalonia.Controls.AppBuilderBase`1.SetupWithLifetime(IApplicationLifetime lifetime) in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 179
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 174
   at XXX.Program.Main(String[] args) in C:\Users\user\Documents\Sources\XXX\XXX\Program.cs:line 5
kekekeks commented 3 years ago

1) show your project file 2) Which SDK version are you using? 3) Show detailed msbuild log

maxkatz6 commented 3 years ago
  1. Delete obj/bin folders
  2. Try again Sometimes VisualStudio can mess up with design time tasks
perfectdev commented 3 years ago
  1. show your project file
  2. Which SDK version are you using?
  3. Show detailed msbuild log
<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>WinExe</OutputType>
        <TargetFramework>net6.0</TargetFramework>
        <ApplicationIcon>AppIcon.ico</ApplicationIcon>
        <Nullable>enable</Nullable>
        <Title>Community Quest</Title>
        <Authors>...</Authors>
        <Description>Community Quest System</Description>
        <Copyright>(c) 2021 ...</Copyright>
        <PlatformTarget>x64</PlatformTarget>
        <Platforms>AnyCPU;x64</Platforms>
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="Avalonia" Version="0.10.10" />
        <PackageReference Include="Avalonia.Desktop" Version="0.10.10" />
        <PackageReference Include="Avalonia.Diagnostics" Version="0.10.10" />
        <PackageReference Include="Avalonia.Native" Version="0.10.10" />
        <PackageReference Include="Avalonia.Xaml.Behaviors" Version="0.10.10" />
        <PackageReference Include="Avalonia.Xaml.Interactions.Custom" Version="0.10.3" />
        <PackageReference Include="AvaloniaAccordion" Version="1.0.0" />
        <PackageReference Include="AvaloniaColorPicker" Version="1.1.0" />
        <PackageReference Include="AvaloniaGraphControl" Version="0.4.0" />
        <PackageReference Include="HarfBuzzSharp" Version="2.8.2-preview.155" />
        <PackageReference Include="HarfBuzzSharp.NativeAssets.Linux" Version="2.8.2-preview.155" />
        <PackageReference Include="HarfBuzzSharp.NativeAssets.macOS" Version="2.8.2-preview.155" />
        <PackageReference Include="HarfBuzzSharp.NativeAssets.Win32" Version="2.8.2-preview.155" />
        <PackageReference Include="Live.Avalonia" Version="1.3.1" />
        <PackageReference Include="Material.Avalonia" Version="2.4.1.25-nightly" />
        <PackageReference Include="MessageBox.Avalonia" Version="1.5.5" />
        <PackageReference Include="OneDark.Avalonia" Version="0.0.4" />
        <PackageReference Include="ReactiveUI" Version="16.3.10" />
        <PackageReference Include="SkiaSharp" Version="2.88.0-preview.155" />
        <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.0-preview.155" />
        <PackageReference Include="SkiaSharp.NativeAssets.macOS" Version="2.88.0-preview.155" />
        <PackageReference Include="SkiaSharp.NativeAssets.Win32" Version="2.88.0-preview.155" />
        <AvaloniaResource Include="**\*.axaml">
            <SubType>Designer</SubType>
        </AvaloniaResource>
        <AvaloniaXaml Remove="App.axaml" />
        <EmbeddedResource Include="App.axaml" />
    </ItemGroup>
    <ItemGroup>
        <ProjectReference Include="..\Library\ComQuestEngine\ComQuestEngine.csproj" />
    </ItemGroup>
    <ItemGroup>
        <Compile Update="UI\MainWindow.axaml.cs">
            <DependentUpon>MainWindow.axaml</DependentUpon>
            <SubType>Code</SubType>
        </Compile>
        <Compile Update="UI\Widgets\ContentEditor\ContentEditor.axaml.cs">
            <DependentUpon>ContentEditor.axaml</DependentUpon>
            <SubType>Code</SubType>
        </Compile>
    </ItemGroup>
    <ItemGroup>
        <None Remove="Translates\ru-RU.xml" />
        <Content Include="Translates\ru-RU.xml">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
    </ItemGroup>
    <ItemGroup>
        <None Remove="Assets\CommandIcons\save.png" />
        <EmbeddedResource Include="Assets\CommandIcons\save.png" />
        <None Remove="Assets\CommandIcons\plus.png" />
        <EmbeddedResource Include="Assets\CommandIcons\plus.png" />
        <None Remove="Assets\CommandIcons\delete.png" />
        <EmbeddedResource Include="Assets\CommandIcons\delete.png" />
        <None Remove="Assets\CommandIcons\error.png" />
        <EmbeddedResource Include="Assets\CommandIcons\error.png" />
        <None Remove="Assets\CommandIcons\info.png" />
        <EmbeddedResource Include="Assets\CommandIcons\info.png" />
        <None Remove="Assets\CommandIcons\warning.png" />
        <EmbeddedResource Include="Assets\CommandIcons\warning.png" />
        <None Remove="Assets\AppIcon.png" />
        <EmbeddedResource Include="Assets\AppIcon.png" />
        <None Remove="Assets\CommandIcons\select.png" />
        <EmbeddedResource Include="Assets\CommandIcons\select.png" />
        <None Remove="Assets\CommandIcons\edit.png" />
        <EmbeddedResource Include="Assets\CommandIcons\edit.png" />
        <None Remove="Assets\CommandIcons\done.png" />
        <EmbeddedResource Include="Assets\CommandIcons\done.png" />
        <None Remove="Assets\CommandIcons\loading.png" />
        <EmbeddedResource Include="Assets\CommandIcons\loading.png" />
        <None Remove="Assets\CommandIcons\waiting.png" />
        <EmbeddedResource Include="Assets\CommandIcons\waiting.png" />
        <None Remove="Assets\CommandIcons\copy.png" />
        <EmbeddedResource Include="Assets\CommandIcons\copy.png" />
    </ItemGroup>
    <ItemGroup>
        <AvaloniaXaml Remove="Styles.axaml" />
        <AvaloniaResource Include="Styles.axaml" />
    </ItemGroup>
</Project>

JetBrainsLog.ReSharperBuild_2021_11_13_16_12_44_3269.log

FoggyFinder commented 3 years ago
  <AvaloniaXaml Remove="App.axaml" />
  <EmbeddedResource Include="App.axaml" />

@perfectdev try to remove those lines