Friday, March 2, 2012

How to use relative paths for an Assembly in the C# projects in order to avoid the conflicts with the references?

Let us consider the following hierarchy of the project



Let us say the working project name is WorkingProject . Follow the following steps in order to use relative paths for the assemblies

1. Add the references to the project (LocalFunctions.dll and LocalClasses.dll) by browsing. To Add reference to a project, right click on the reference folder and click on add reference.

2. Open the physical location of the WorkingProject

3. Edit the .csproj file in notepad++ or notepad.

4. Look for the HintPath tag for each and every reference and check the required relative paths under this tag value.

E.g. in this case it should be like this


a)      ..\..\ LocalSolution \ LocalFunctions \bin\Debug\LocalFunctions.dll
b)      ..\..\ LocalSolution \ LocalClasses\ bin\Debug\ LocalClasses.dll



Note: By default these relative paths will be populated based on the added references w.r.t. current working directly of the project.

If you need any windows assembly use path like

C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll



No comments:

Post a Comment