How to set Reference Alias in csproj?


  • If I have 2 dlls with same name, public key token and culture.
    How can I reference them both in the same C# project?

    Scenarios: having to reference and old and new dll for the sake of upgrade.

    Min Chew

    Solution here

    1. In app.config
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <assemblyIdentity name="myAssembly"
                              publicKeyToken="here token dll"
                              culture="neutral" />
           <bindingRedirect oldVersion="" newVersion="" />
           <bindingRedirect oldVersion="" newVersion="" />
           <codeBase version="" href="folder\namedll.dll" />
           <codeBase version="" href="folder\namedll.dll" />

    2. Unload and edit the csproj file, and add or set:


    • Moved by Sabah ShariqMVP Tuesday, March 14, 2017 10:40 AM Moved From Visual C#
    • Edited by Min Chew Monday, May 15, 2017 9:44 AM Removed verbosity, rewrote question and added answer
    Tuesday, March 14, 2017 1:39 AM


All replies