开发者

GAC Assembly Reference in App.Config (Console Applications)

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜