Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
実行時にアセンブリの場所を返す方法を探しています。Assembly.Location は使用できません。NUnit で実行すると、シャドウ コピーされたアセンブリのパスが返されるためです。
代わりに CodeBase プロパティを使用してください。シャドウ コピーされた dll の場所ではなく、元の dll の場所が返されます。
例えば:
Assembly assembly = GetType().Assembly; Uri codeBaseUri = new Uri(assembly.CodeBase); string path = codeBaseUri.LocalPath;