How to get DEVPATH assemblies in the Add reference window in Visual Studio 2010?
Asked Answered
A

1

0

I want to add reference to an assembly that is in the Devpath folder. But it does not appear in the Add Reference Window.

the C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config is updated with :

<runtime>
    <developmentMode developerInstallation="true"/>
</runtime>

The environment variable DEVPATH is set in system variable as
C:\SharedAssemblies

I try to add the reference directly into the project file :

<Reference Include="AssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=123456789, processorArchitecture=MSIL">

But MSBuild do not look at the devpath folder and returns

warning MSB3245: Could not resolve this reference. Could not locate the assembly...

How does this work ?


If I add the assembly to the GAC, the Fusion log show me that the devpath folder is used :

*** Entrée du journal Binder d'assembly  (28/11/2012 @ 15:09:07) ***

L'opération a réussi.
Résultat de liaison : hr = 0x0. L’opération a réussi.

Gestionnaire des assemblys chargé à partir de :  C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Exécution sous l'exécutable  c:\users\User\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe
--- Un journal des erreurs détaillé suit. 

=== Informations d'état de liaison préalable ===
JRN : utilisateur = User
JRN : DisplayName = AssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=123456789
 (Fully-specified)
JRN : Appbase = file:///c:/users/User/documents/visual studio 2010/Projects/ConsoleApplication1/ConsoleApplication1/bin/Debug/
JRN : DEVPATH = C:\SharedAssemblies
JRN : PrivatePath initial = NULL
JRN : base dynamique = NULL
JRN : base de cache = NULL
JRN : AppName = NULL
Assembly appelant : Microsoft.VisualStudio.HostingProcess.Utilities, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
===
JRN : cette liaison démarre dans le contexte de chargement de default.
JRN : utilisation du fichier de configuration de l'application : c:\users\User\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe.Config
JRN : utilisation du fichier de configuration de l'ordinateur à partir de C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
JRN : référence post-stratégie : AssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=123456789
JRN : un assembly a été trouvé dans le chemin d'accès DEVOVERRIDE C:\SharedAssemblies\AssemblyName.DLL
Adhamh answered 28/11, 2012 at 10:54 Comment(3)
The DEVPATH environment variable is only used when you run your program, not when you build it. It is an alternative for putting assemblies in the GAC. Getting reference assemblies from DEVPATH is just as wrong as adding references that are stored in the GAC. It is not maintainable.Achieve
Why is it not maintainable ?Adhamh
What is the goal of storing assembly in the GAC if it's wrong to reference it ???Adhamh
A
1

Adding the registry key

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\DEVPATH]@="C:\SharedAssemblies"

does the job.

MSDN reference

Adhamh answered 28/11, 2012 at 16:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.