Search code examples
visual-studiovisual-studio-2019visual-studio-extensions

In Visual Studio Professional 2019, How do you change the common Extensions directory?


I am migrating my installation of Visual Studio 2019 from G:\ to L:... and I have had mostly no problems, moving all the references. Except when it came to some 'Extensions' and some projects. After changing all the references I could find in 'Regedit' and in the copied directory. I must still have missed something. To check to see if I was successful: I purposely renamed the 'G:' drive sub directory from 'Extensions' to '...\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions_old'. After doing that I receive errors like this in the ActivityLog.xml

<entry>
<record>675</record>
<time>2023/10/30 14:36:16.637</time>
<type>Error</type>
<source>VisualStudio</source>
<description>CreateInstance failed for package [UnityPackage]Source: &apos;mscorlib&apos; Description: Could not load file or assembly &apos;file:///g:\program files (x86)\microsoft visual studio\2019\professional\common7\ide\extensions\microsoft\visual studio tools for unity\SyntaxTree.VisualStudio.Unity.dll&apos; or one of its dependencies. The system cannot find the file specified.&#x000D;&#x000A;System.IO.FileNotFoundException: Could not load file or assembly &apos;file:///g:\program files (x86)\microsoft visual studio\2019\professional\common7\ide\extensions\microsoft\visual studio tools for unity\SyntaxTree.VisualStudio.Unity.dll&apos; or one of its dependencies. The system cannot find the file specified.&#x000D;&#x000A;File name: &apos;
file:///g:\program files (x86)\microsoft visual studio\2019\professional\common7\ide\extensions\microsoft\visual studio tools for unity\SyntaxTree.VisualStudio.Unity.dll&apos;&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark&amp; stackMark)&#x000D;&#x000A;   at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence)&#x000D;&#x000A;   at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)&#x000D;&#x000A;   at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)&#x000D;&#x000A;&#x000D;&#x000A;WRN: Assembly binding logging is turned OFF.&#x000D;&#x000A;To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.&#x000D;&#x000A;Note: There is some performance penalty associated with assembly bind failure logging.&#x000D;&#x000A;To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].&#x000D;&#x000A;</description>
<guid>{B6546C9C-E5FE-4095-8D39-C080D9BD6A85}</guid>
<hr>80004005 - E_FAIL</hr>
<errorinfo></errorinfo>
I do not wish to reinstall everything. I was trying to find an easier way. I was hoping it could just be a change in a text-like file. I am dumping the 'G' drive.

Solution

  • Really the answer for me was Make sure VS was closed. 1) {Windows-10} Use right-click Windows Icon. Click 'Disk Management'. 2) Change my 'G' drive-letter to 'W'. 3) Change my 'L' drive-letter to 'G'.

    So that effectively makes the 'L' drive the 'G' drive. Then I had already mixed up Registry items to the 'L' drive and messed up my 'Cache'. All the damage I had done in comments above I had to correct. I changed back all the references back to 'G' in the registry, and anyone who finds this..."please ignore that part...". Really the only thing anybody finding this will have to do may be the above 'Disk-Management' step. So I had to delete the folder: \Users\{User}\AppData\Local\Microsoft\VisualStudio\16.0_xxx In my case '16.0_5672de2b'. Then when I restarted VS, it says it had to restart for 'first time use'... but then it loaded fine. Including the 'Unity' project that failed above.