How do I reference assemblies outside the bin folder in an ASP.net application?

后端 未结 5 1562
梦谈多话
梦谈多话 2020-12-05 16:14

I\'ve a working XML Web service written in ASP.Net. Now I need to reference certain assemblies lying in a specific folder e.g. c:\\NotMyCode
I do no

5条回答
  •  情书的邮戳
    2020-12-05 16:52

    According to the MSDN documentation,

    Referenced assemblies outside the application's root directory must have strong names and must either be installed in the global assembly cache or specified using the element.

    So, it might appear that you're out of luck. Here's what I'd try:

    1. Create an NTFS junction point under your application base directory which points to the directory containing your shared code. This is the key step. For example, in your application base directory, run linkd SharedCode c:\NotMyCode. This makes \SharedCode effectively be an alias for c:\NotMyCode.
    2. Tell ASP.NET to probe for assemblies in this path, using a element, referencing the junction point SharedCode. Since this is under your application base, it should work. Alternatively, use AppDomainSetup.PrivateBinPath to set the path probed for assemblies.

    I'm quite curious to see if this works :-)

提交回复
热议问题