dll を実行時参照

  デフォルトの参照場所



1) アプリケーションと同じディレクトリ
2) dll の名前と同じ名前を持つ下位ディレクトリ

App01.exe
lightbox.dll

または

App01.exe
lightbox\lightbox.dll



  .exe.config ファイルによる、任意の下位ディレクトリへの参照



App01.exe
App01.exe.config
lib\lightbox.dll

App01.exe.config ( 下位の lib ディレクトリに lightbox.dll を置く事ができる )
  
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
	<runtime>
		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
			<probing privatePath="lib"/>
		</assemblyBinding>
	</runtime>
</configuration>
  



  任意のディレクトリへの参照



1) ライブラリを上記設定により、厳密な名前を与えます。
( ビルド後、読み込む側を再ビルドする必要があります )

2) "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe" -T lightbox.dll
を実行して、公開キートークンを取得します。

b881501e46e80944

App01.exe.config
  
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
	<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
		<dependentAssembly>
			<assemblyIdentity
				name="lightbox"
				culture="neutral"
				publicKeyToken="b881501e46e80944"/>
			<codeBase
				version="1.0.0.0"
				href="C:\tmp\lightbox.dll"/>
		</dependentAssembly>
	</assemblyBinding>
</runtime>
</configuration>
  










  infoboard   管理者用   
このエントリーをはてなブックマークに追加





フリーフォントWEBサービス
SQLの窓WEBサービス

SQLの窓フリーソフト

素材

一般WEBツールリンク

SQLの窓

フリーソフト

JSライブラリ