Private assembly reference path

  • Thread starter Thread starter Yang Liu
  • Start date Start date
Y

Yang Liu

Hi all,
I have a .net windows application xx.exe, which reference
a private assembly yy.dll, the property "local copy" of
the yy.dll reference is automatically set to true, so the
yy.dll will be copied to the output folder, which is the
same folder as the xx.exe, that means when I deploy the
application xx.exe, I must include the yy.dll to the same
folder as the xx.exe exists in, but I want the folder that
include the xx.exe(it's always the application root dir)
to be clean, how do I move the yy.dll to a subfolder, that
means I want to change the private assembly to a different
folder from the application folder.

Regards
 
If you're using 1.1, you can load an assembly from a fixed path using
Assembly.LoadFile() but you'd have to modify your code so that it creates
types from your other assembly this way.

I think you can use AppDomain.CurrentDomain.AppendPrivatePath to add a path
that will be used in the resolution process. I do believe it does not accept
relative paths though, so if this is a subfolder of your app's root folder
you'll have to get the full path. Or just use .\Bin?
 
Hi

You can use the PrivateBinPath propeerty in the config
file for this. You can create subfolders inside your bin
folder and specify the subfolder path in the
privatebinpath element of the config file. This will hint
the runtime to search for tyhe assembly in the specified
subfolder at the time of assemblty locaton. Optinally as
Klaus suggested you can do the same thru coding also
using the AppDomain.CurrentDomain.AppendPrivatePath snippet


hth

regards,

sr
 
Back
Top