开发者

Specifying the location of an assembly to II

My ASP.NET application uses some 3rd assembl开发者_Go百科y. What are my options to make the application load that assembly? Do I have to put it in the GAC? I don't want to modify the machine's PATH env variable...


You can put it into your application folder (best solution) or add a codebase tag in your web config like explained in this msdn entry:

<configuration>
 <runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
     <dependentAssembly>
        <assemblyIdentity name="MyAssembly2"  culture="neutral" publicKeyToken="307041694a995978"/>
        <codeBase version="1.0.1524.23149" href="FILE://C:/Myassemblies/MyAssembly2.dll"/>
     </dependentAssembly>
  </assemblyBinding>
 </runtime>
</configuration>

Add it to the GAC only if you want to share that assembly.


Is your assembly strongly named?

You can either put it in the GAC or reference it in your web.config (using a <codeBase> element according to this MSDN article.

If not

The assembly has to live in the bin folder of your web application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜