Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6878265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:42:09+00:00 2026-05-27T04:42:09+00:00

So I have an application and a class library. The class library has UserControls/Test.xaml

  • 0

So I have an application and a class library.

The class library has

UserControls/Test.xaml
Images/TestImage.png

Test image is marked as ‘Content’ and ‘Copy to Output Directory’ is set to false because I want all of my images to be stored inside the class dll.

Test.xaml looks something like this…

<UserControl x:Class="TestLib.UserControls.Test"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         mc:Ignorable="d" 
         >
         <Image Source="/TestLib;component/Images/TestImage.png"/>
</UserControl>

The designer works fine but when I try to instantiate the UserControl/Test.xaml in my application then it throws the following exception:

System.IO.IOException occurred
Message=Cannot locate resource 'images/TestImage.png'.
Source=PresentationFramework
StackTrace:
   at MS.Internal.AppModel.ResourcePart.GetStreamCore(FileMode mode, FileAccess access)
InnerException: 

I have tried changing the resource type to “Resource” and “Embedded Resource” but neither makes any difference. I have also tried using the full pack string

"pack://application,,,/TestLib;component/Images/TestImage.png" 

but it throws the exact same exception even stating the same ‘images/TestImage.png’.

Edit: I forgot to mention that Images/TestImage.png is not “included” it is “included as link”. Apparently this is the problem because of a compiler bug: Linked Files within a Folder Structure

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:42:10+00:00Added an answer on May 27, 2026 at 4:42 am

    It looks like the solution is to not use “linked” instead of “included” resources within libraries. The compiler fails to respect their path which makes them impossible to reference when using them inside of a class library. See: Linked Files within a Folder Structure

    Even if the linked file lives on the root of a project you still cannot reference it at runtime.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that uses (has referenced) a class library (myLib.dll private assembly).
I have a solution that has three projects: WPF Application Class Library NUnit Testing
I have a console application and two class library projects. The console application has
I have a class Application that my global.asax inherits from. The class has this
I have standard class library infrastructure assembly which i reference in my main application.
I have the business logic of an workflow-like application in a C# class library,
I have a WCF Web application that uses a WCF Class Library. My project
I have the following projects: MVC Console application Class library Windows forms application COM
I have a class library that has it's own model and connectionstring to the
I have a Windows Forms application with a reference for the class library in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.