Not able to reference assemblies from parent directory in a installation path

67 Views Asked by At

After installation the software has below structure:

Base installation directory path is : C:/ProgramFiles/APP_Name/App_Base_Dir

Exe Path: C:/ProgramFiles/APP_Name/App_Base_Dir/2ndAppFolder/bin/2ndApp.exe

While trying to run the 2ndApp.exe it is dependent on dlls which are present in the base directory path. How I can refer those dlls in 2ndApp.exe.config file.

I have tried to use AssemblyProbing but it seems to be not working in this case.

Please suggest some other options or correct me in AssemblyProbing.

I have tried adding AssemblyProbing tag in config file.

`<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">  
     <probing privatePath="App_Base_Dir"/>  
   </assemblyBinding>

`

1

There are 1 best solutions below

0
Pablo Mederos On

If you are referencing dlls from another assembly, you just can use de following approach in the .csproj file:

    <ItemGroup>
    <Reference Include="dllExported" >
      <HintPath>../../dllExportedTest</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
  </ItemGroup>

But if that you need is to reference another project in another folder, you can use this:

  <ItemGroup>
    <ProjectReference Include="..\..\AnotherProject\AnotherProject.csproj" />
  </ItemGroup>