0

I need use images in 2 .NET assemblies. One is WPF app {myApp.exe} and second is *.dll {myDll.dll}. File are located in this file structure:

 **AppFolder** consist these files and one subfolder(avatars):

    -myApp.exe
    -myDll.dll
    -avatars {folder} consist:
          -manImages.jpg
          -womanImages.jpg

I try user uri in this format

new Uri(@"C:\Users\avatars\manImages.jpg", UriKind.RelativeOrAbsolute);

but this format does not work, images are empty.

2 Answers 2

1

I would expect

new Uri(@"avatars\manImages.jpg", UriKind.RelativeOrAbsolute);

to work?

You could also try:

new Uri(Environment.CurrentDirectory + @"\avatars\manImages.jpg", UriKind.RelativeOrAbsolute);
Sign up to request clarification or add additional context in comments.

2 Comments

I was under the impression that he wanted the new URL statement to work. This is an answer to that question. Am I missing something?
Hogan, in my questin is mistake in @"C:\Users\avatars\manImages.jpg", it should be avatars\manImages. But it does not work. This alternativ : return new Uri(Environment.CurrentDirectory + @"\avatars\man.jpg", UriKind.RelativeOrAbsolute); work goods. Thank you.
0

On the dll side you can write this:

string imgPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "avatars\\manImages.jpg");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.