How can I reference a resource (png) from a seperate project in the same solution

后端 未结 1 1612
时光取名叫无心
时光取名叫无心 2021-01-28 16:10

My solution is structured as follows:

  1. Class Library (Name = Chess)
    • Images
      • Pawn.png
  2. WPF Core 3.1 Project (Name =
相关标签:
1条回答
  • 2021-01-28 16:48

    Tried this with a plain netcoreapp3.1 class library.

    While in XAML Designer the ChessApp's MainWindow correctly shows the image resource, I see a System.Resources.MissingManifestResourceException at runtime.

    Changing the class library project's Sdk property from

    <Project Sdk="Microsoft.NET.Sdk">
    

    to

    <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
    

    fixed the problem.

    0 讨论(0)
提交回复
热议问题