开发者

GAC Assembly Reference in App.Config (Console Applications)

开发者 https://www.devze.com 2022-12-24 01:06 出处:网络
I have a dll installed in GAC. I have not issues reading that assembly from asp.net applications the assembly reference i have done in web.config is able to refer to that assembly.

I have a dll installed in GAC. I have not issues reading that assembly from asp.net applications the assembly reference i have done in web.config is able to refer to that assembly.

But in the console application, when i put the below in the app.config file, the solution gets compiled, but i am not able to access the dll from program.cs file.

Below is my app.config to refer to the dll in GAC.

<configuration>
    <comp开发者_JAVA技巧ilation debug="true">
        <assemblies>
            <add assembly="myassembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9999999999999"/>
        </assemblies>
    </compilation>
</configuration>


Try this instead:

      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="filename"
                              publicKeyToken="999999999999"
                              culture="neutral" />
            <codeBase href="file:///C:\dir\filename.dll"/>


        </dependentAssembly>
      </assemblyBinding>

You can also refer to this for reference:

http://www.codeproject.com/KB/install/assemblydeployment.aspx?display=Print

0

精彩评论

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

关注公众号