2011年12月1日木曜日

dll の場所

ばかのひとつおぼえ

みたいに,こんな風に書いてたの。

Public Shared Function ApplicationPath() As String
  Return System.IO.Path.GetDirectoryName( _
      System.Reflection.Assembly.GetEntryAssembly().Location)
End Function

dll のときは

exe のとなりにおいてるときには問題ないんだろうけれど,dll ディレクトリにまとめて~,とかやってるとダメ。そんなときは,

System.Reflection.Assembly.GetExecutingAssembly().Location)
とするみたい。

りんく

現在実行しているDLLのパスを取得する。(GetExecutingAssembly ) - tekkの日記 C#,VB.NET