-1

I am a newbie to c# and developed a small WPF application which depends on a external dll files. I have added it as reference in the visual studio and started using the methods in side it.

I started to face the problem when I am deploying this utility to other computers. It is mandating me to place the external dll file in the same location of WPF exe file. And I want to avoid this. Instead I want it to look a specific folder(local or remote).

Is it possible to do this way?

Thanks, Sitaram

Konrad Morawski
  • 8,307
  • 7
  • 53
  • 91
Sitaram Pamarthi
  • 445
  • 3
  • 5
  • 14
  • How are you deploying your application? Do you use `ClickOnce`? – Konrad Morawski Aug 22 '12 at 10:51
  • Duplicate? http://stackoverflow.com/questions/2445556/c-sharp-putting-the-required-dlls-somewhere-other-than-the-root-of-the-output – cnd Aug 22 '12 at 10:52
  • there are lots of ways to deploy: http://msdn.microsoft.com/en-us/library/aa969776.aspx – ddoor Aug 22 '12 at 10:52
  • Almost any program deploys as a single file. Called setup.exe. Very easy to do with a Setup project. – Hans Passant Aug 22 '12 at 10:53
  • This thread might be helpful http://stackoverflow.com/questions/1373100/how-to-add-folder-to-assembly-search-path-at-runtime-in-net – Samyam A Aug 22 '12 at 10:55
  • Thanks everyone for your suggestions. I will go through the links you provided and get back to you. – Sitaram Pamarthi Aug 22 '12 at 14:43
  • 1
    @Liam : I did that. I am sorry for not paying attention to marking them as answers before. But it is not definitely negligence.I value the peoples efforts and will try to keep up self in marking them as answers where ever applicable. Thanks for highlighting that. – Sitaram Pamarthi Aug 22 '12 at 14:51

1 Answers1

0

The best solution would be to set the LocalCopy Property of the Reference to true. That will copy it to your output exe.

A very bad solution would be to load the assembly manuall in code (Assembly.Load) and add it to your AppContext.

Florian
  • 5,918
  • 3
  • 47
  • 86