Can I access assemblies in Visual Studio PublicAssemblies folder

Shelley xie 1 Reputation point
2022-07-05T07:21:45.637+00:00

I have an executable application which has references to other projects. The other projects has references to the assemblies located at C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\PublicAssemblies folder.
I cannot copy these assemblies from PublicAssemblies folder to my executable project bin path.
I tried to configure these assemblies location in the executable application config file, as below:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.Shell.Interop"
publicKeyToken="b03f5f7f11d50a3a"
culture="neutral" />
<codeBase version="7.1.40304.0"
href="file://C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.Shell.Interop.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

The configuration works. But the file location is hardcode. If I install my executable application on another machine which installed Visual Studio in the other place, then this config file will not work any more.

I would like to know if any way to give a dynamic path in the href tag?

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,981 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,101 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ken Tucker 5,841 Reputation points
    2022-07-05T09:56:37.69+00:00

    Use the nuget package instead of referencing the dll in the visual studio folder

    https://www.nuget.org/packages/Microsoft.VisualStudio.Shell.Interop

    0 comments No comments