Click here to Skip to main content
15,885,757 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to reference .net DLL present in other folder Pin
jschell24-Dec-12 8:00
jschell24-Dec-12 8:00 
GeneralRe: How to reference .net DLL present in other folder Pin
KASR125-Dec-12 7:11
KASR125-Dec-12 7:11 
GeneralRe: How to reference .net DLL present in other folder Pin
jschell25-Dec-12 16:32
jschell25-Dec-12 16:32 
GeneralRe: How to reference .net DLL present in other folder Pin
KASR126-Dec-12 1:31
KASR126-Dec-12 1:31 
GeneralRe: How to reference .net DLL present in other folder Pin
jschell26-Dec-12 7:48
jschell26-Dec-12 7:48 
AnswerRe: How to reference .net DLL present in other folder Pin
Karthik. A25-Dec-12 5:51
Karthik. A25-Dec-12 5:51 
GeneralRe: How to reference .net DLL present in other folder Pin
KASR125-Dec-12 7:10
KASR125-Dec-12 7:10 
AnswerRe: How to reference .net DLL present in other folder Pin
Alan N26-Dec-12 5:12
Alan N26-Dec-12 5:12 
Yes this is possible, for strongly named assemblies, with an addition to the configuration section of the application's configuration file ( appname.exe.config ).

In this example we have an assembly StealthLib.dll which has been moved out of the applications's base directory to v:\Temp. Information about this new location is given in the dependentAssembly element where we must specify the assemblyIdentity and the codeBase.

XML
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="StealthLib" publicKeyToken="e0505f3b3553d5af"/>
        <codeBase version="1.0.0.0" href="file://v:/Temp/StealthLib.dll"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>


Be really careful when editing the configuration file as errors are silently ignored. For example the assembly will not be found if the casing of publicKeyToken is changed to PublicKeyToken.

The Assembly Binding Log Viewer (FUSLOGVW.exe) which comes with the .NET SDK is very useful for resolving assembly loading problems as it will log all the locations that have been searched for dependent assemblies.

Text"
LOG: Appbase = file:///E:/VC/Projects/CP/AssemblyProbing/MainProg/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MainProg.exe
Calling assembly : MainProg, Version=1.0.4743.26012, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: E:\VC\Projects\CP\AssemblyProbing\MainProg\bin\Debug\MainProg.exe.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: StealthLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e0505f3b3553d5af
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///v:/Temp/StealthLib.dll.
LOG: Assembly download was successful. Attempting setup of file: v:\Temp\StealthLib.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: StealthLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e0505f3b3553d5af
LOG: Binding succeeds. Returns assembly from v:\Temp\StealthLib.dll.
LOG: Assembly is loaded in default load context.


Good luck

Alan.
GeneralRe: How to reference .net DLL present in other folder Pin
KASR126-Dec-12 7:41
KASR126-Dec-12 7:41 
GeneralRe: How to reference .net DLL present in other folder Pin
Alan N26-Dec-12 7:48
Alan N26-Dec-12 7:48 
GeneralRe: How to reference .net DLL present in other folder Pin
KASR12-Jan-13 7:08
KASR12-Jan-13 7:08 
GeneralRe: How to reference .net DLL present in other folder Pin
Alan N2-Jan-13 8:51
Alan N2-Jan-13 8:51 
GeneralRe: How to reference .net DLL present in other folder Pin
KASR18-Jan-13 8:00
KASR18-Jan-13 8:00 
QuestionRe: How to reference .net DLL present in other folder Pin
PIEBALDconsult26-Dec-12 9:13
mvePIEBALDconsult26-Dec-12 9:13 
AnswerRe: How to reference .net DLL present in other folder Pin
KASR126-Dec-12 16:25
KASR126-Dec-12 16:25 
QuestionUsage of Google API in windows application Pin
ukraju24-Dec-12 1:05
ukraju24-Dec-12 1:05 
AnswerRe: Usage of Google API in windows application Pin
David C# Hobbyist.24-Dec-12 2:25
professionalDavid C# Hobbyist.24-Dec-12 2:25 
AnswerRe: Usage of Google API in windows application Pin
Sajeesh Payolam24-Dec-12 20:28
Sajeesh Payolam24-Dec-12 20:28 
QuestionDetecting a 3G connection in Windows 7 and 8 in a desktop application Pin
REDSERPENT724-Dec-12 1:04
REDSERPENT724-Dec-12 1:04 
AnswerRe: Detecting a 3G connection in Windows 7 and 8 in a desktop application Pin
MaulikDusara24-Dec-12 20:44
MaulikDusara24-Dec-12 20:44 
GeneralRe: Detecting a 3G connection in Windows 7 and 8 in a desktop application Pin
REDSERPENT729-Dec-12 21:33
REDSERPENT729-Dec-12 21:33 
QuestionIpstatus.Success answer twice !! Pin
Alex1971_rm24-Dec-12 0:15
Alex1971_rm24-Dec-12 0:15 
QuestionHow do i create an object of partial class in user control Pin
swapnil709022-Dec-12 20:27
swapnil709022-Dec-12 20:27 
AnswerRe: How do i create an object of partial class in user control Pin
nainakarri22-Dec-12 22:03
nainakarri22-Dec-12 22:03 
Questionerror i declaring null arrays Pin
tashee22-Dec-12 5:22
tashee22-Dec-12 5:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.