How to restore Visual Studio 2015 after the Update 1 (dependency dance)

Update 12/11/2015: Two issues were opened as a result of investigation “Installing the fsharp power tools before installing adding VS2015 update 1 breaks Roslyn” in Visual F# Power Tools repository and “We read some settings from the devenv.exe.config file — devenv.exe.config is not user mutable” in Visual F# repository.

This post is prepared especially to save F# Advent Calendar in English 2015 schedule.

Short version of the fix posted on Stack Overflow.

Note: Described fix is not permanent, VS may reset your changes in devenv.exe.config file after the new extensions install/update.

Yesterday Microsoft released the first update to Visual Studio 2015 that contains some pretty cool features and improvements, but this update has broken “some” machines.

During the first run after the update, you may see errors like this one:

VSexception

or even NullReferenceException when you try to open the list of installed extensions

In order to fix all this stuff you need to check ActivityLog.xml file (c:\Users\{user_name}\AppData\Roaming\Microsoft\VisualStudio\14.0\) and find the exact error message. Most probably, you will see something like this

SetSite failed for package [CSharpPackage][Could not load file or assembly ‘System.Collections.Immutable, Version=1.1.36.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]:{ at Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService.AbstractPackage`2.Initialize() at Microsoft.VisualStudio.LanguageServices.CSharp.LanguageService.CSharpPackage.Initialize() at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp)}

This error says that bindingRedirect set up incorrectly for VS process. You need to find file devenv.exe.config in c:\Users\{user_name}\AppData\Local\Microsoft\VisualStudio\14.0\ and update it. (Or c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\, depending of location of your devenv.exe file).

For this particular case, you should find rows that setup redirects for System.Collections.Immutable and change newVersion from 1.1.36.0 to 1.1.37.0. Final config should look like this

<dependentAssembly>
  <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
  <bindingRedirect oldVersion="1.0.27.0-1.1.65535.65535" newVersion="1.1.37.0"/>
</dependentAssembly>

After this fix, I was able to load my IDE and setup latest version of Azure SDK 2.8.1 that reset my changes in .config file and I needed to fix it once again.

Everything was OK, until I have tried to open my web project. This time it crashed with the following error in ActiveLog.xml:

SetSite failed for package [JavaScriptWebExtensionsPackage][Could not load file or assembly 'Microsoft.VisualStudio.ProjectSystem.V14Only, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]:{   at Microsoft.VisualStudio.Html.Package.Utilities.ProjectUtilities.IsImmersiveProject(IVsHierarchy hierarchy)   at Microsoft.VisualStudio.Html.Package.Project.WebProjectServices.IsWebProject(IVsHierarchy hierarchy)   at Microsoft.VisualStudio.Html.Package.Project.WebProjectServices.AdviseProject(IVsHierarchy hierarchy)   at Microsoft.VisualStudio.Html.Package.Project.WebProjectServices.AdviseOpenedProjects(IVsSolution solution)   at Microsoft.VisualStudio.Html.Package.Project.WebProjectServices.HookGlobalEvents()   at Microsoft.VisualStudio.Html.Package.Project.WebProjectServices.Microsoft.VisualStudio.Html.Package.Project.IWebProjectServices.get_OpenedProjects()   at Microsoft.VisualStudio.JavaScript.Web.Extensions.ReferenceAutoSync.ProjectServices.Initialize()   at Microsoft.VisualStudio.JavaScript.Web.Extensions.ReferenceAutoSync.ProjectServices..ctor()   at Microsoft.VisualStudio.JavaScript.Web.Extensions.JavaScriptWebExtensionsPackage.Initialize()   at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp)}

After the search on C:\ drive for Microsoft.VisualStudio.ProjectSystem.V14Only.dll I realized that my machine has version 14.1.0.0 instead of 14.0.0.0. So it looks like we need to add one more redirect in devenv.exe.config.

<dependentAssembly>
  <assemblyIdentity name="Microsoft.VisualStudio.ProjectSystem.V14Only" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
  <bindingRedirect oldVersion="14.0.0.0" newVersion="14.1.0.0"/>
</dependentAssembly>

After these fixes, I have not seen any other errors on my machine (at least for now). I hope that you understand the core idea on how to troubleshoot and fix such errors. So good luck to you and VS team with dependency fighting.

P.S. One more useful advice that can save you time – try to clear Component Model Cache if things start going wrong.

39 thoughts on “How to restore Visual Studio 2015 after the Update 1 (dependency dance)

  1. Thank you for this. I worried that I’d need to uninstall / reinstall Visual Studio. That crazy Collections.Immutable reference made it so that Visual Studio wouldn’t fail every time trying launch the Extensions and Updates.

  2. Changing the config in user folder has not worked for me. I had to change the one laying in c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\, after that all the errors has gone.

  3. Thank you for the blog post! I’m the engineering manager for Visual Studio setup, and I found this blog after investigating the same issue. As for why this happened, I’ve learned that our installer does not lay down the VSUpdate 1 version of devenv.exe.config if it detects that the file has changed since VS2015 RTM shipped. What I don’t yet know is how or why the file changed. So my ask to those of you reading this blog (Sergey and others) is…if you still have the devenv.exe.config file that caused VS to fail as described above, would you please contact me at eric.knox@microsoft.com? By examining bad config files, I’m hoping to understand what changed so we can better guard against this problem ever happening again. And thanks again for discovering a solution to this problem. I’ll work on making sure it doesn’t happen again (and seeing what options VS has for fixing this problem without requiring users to work around it).

    1. Hello Eric, this is my file. I’m not allowed to change ist even I am System Administrator.


      1. @Erich – I’m not sure what you mean. VS setup will modify this file because it’s running with administrator privileges. Do you mean that you can’t modify the file yourself because you can’t log in as a machine administrator? If so, how are you installing VS itself?
        Also, if you can’t do that for some reason, the other (very painful) workaround is to uninstall VS and reinstall it. If you go that route, I’d recommend installing “VS with Update 1” (community, professional or enterprise) because it’s faster on a machine without VS. I don’t recommend that approach simply because it takes so long, but it will work.
        Last, if you install Update 1 now, you should not encounter this problem if you’re online. We released a servicing hotfix that setup automatically fetches and applies before installing Update 1 which makes the file writable by VS setup.
        Does that help?

    2. The shitty part is the Collections.Immutable issue affects any Studio 2015 Shell applications that weren’t rebuilt against Update 1.

      1. @mroszko – can you tell me what other application is impacted? I’d like to track them all down and make sure they all get fixed. (In the meantime, I’ll point some VS folks at this and see if they can figure it out themselves, but it would help me to be confident that we’ve found all impacted apps).

  4. Thank Sergey, I appreciate your putting this up here for us.

    I’ve tried everything here and on stackoverflow. Sadly, the only thing left is a total reinstall. This visual studio update refuses to remain fixed and I’m totally hacked off with MS for having broken this – what looks like such a small thing – yet it cripples the whole project system.

    1. @Richard G – I’d be happy to try and help you sort this out if you don’t mind contact me directly at eric.knox@microsoft.com. If you have the time, I’ll send you instructions for how to collect setup logs, and I can analyze them and see if you’re running into something I can tell you how to work around. [Plus, I’ll use your report to drive future investments.] Eric (Visual Studio engineering manager)

  5. Need help.

    My devenv.exe.config doesn’t have section with assemblyIdentity name=”Microsoft.VisualStudio.ProjectSystem.V14Only”.
    but activity log has error:

    591
    2015/12/16 20:01:24.449
    Error
    VisualStudio
    End package load [JavaScriptWebExtensionsPackage]
    {30DB8F9B-EC9F-44D6-B377-83C7C27A1A8B}
    80131040
    Could not load file or assembly ‘Microsoft.VisualStudio.ProjectSystem.V14Only, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

  6. Thank you very much for your post and your generous tip on how to determine the root cause of in these problems! You saved me (and I’m sure many others) from many wasted hours of following dead-end fixes.

    The most common fix that comes up for these errors is clearing the component cache, but this does not work for VS2015. Your changes do.

    I hope the VS2015 team takes notice.

    1. My name is Eric Knox, and I’m an engineer on the VS setup team. We’ve definitely noticed this and have actually shipped a hotfix last night (Dec 16th ~6pm PST) so that future installs of Update 1 should correctly lay down the Update 1 config file. If you are reading this, I’d encourage you to look at this post on the VS Setup forums because Sergey’s workaround is a partial fix: https://social.msdn.microsoft.com/Forums/vstudio/en-US/e011bc08-8b1d-4a2a-99d6-a167da922145/visual-studio-2015-update-1-fails-to-update-devenvexeconfig-plus-fix?forum=vssetup
      I can’t say for sure what will break without the full fix, but I’d recommend getting the correct Update 1 config file.
      Thanks again for diagnosing this issue Sergey!

      1. Hi Eric, I want to give you the feedback, that it is still not possible to install or repair the visual studio. It always breaks with errors like:

        [0F64:14E0][2015-12-23T09:49:26]i351: Removing cached package: vs_teamExplorerCore, from path: C:\ProgramData\Package Cache\{791295AE-3B0A-3222-9E69-26C8C106E8D1}v14.0.23102\
        [0F64:14E0][2015-12-23T09:49:26]w353: Unable to remove cached package: vs_teamExplorerCore, from path: C:\ProgramData\Package Cache\{791295AE-3B0A-3222-9E69-26C8C106E8D1}v14.0.23102\, reason: 0x80070003. Continuing…
        [0F64:14E0][2015-12-23T09:49:26]i351: Removing cached package: JavaScript_LanguageService.msi, from path: C:\ProgramData\Package Cache\{25F2D0A2-897D-4C10-B89A-CB70E785BBB5}v14.0.23201\
        [0F64:14E0][2015-12-23T09:49:26]i351: Removing cached package: EnableGraphicsTools, from path: C:\ProgramData\Package Cache\F99F412B-272C-3A90-A948-12735E3B4F96\
        [0F64:14E0][2015-12-23T09:49:26]i351: Removing cached package: vs_preclean_vs, from path: C:\ProgramData\Package Cache\A9B8C8BA7CB095AE7A9CF921CD95E62261950C81\
        [0F64:14E0][2015-12-23T09:49:26]i351: Removing cached package: VSSetupUtility_Start_vs_community, from path: C:\ProgramData\Package Cache\69A56481-ADE8-3A5B-8210-9B9D2D4633EA\
        [0F64:14E0][2015-12-23T09:49:26]i351: Removing cached package: Preparation_Uninstall_vs_community, from path: C:\ProgramData\Package Cache\5AE41D8D-8DEE-3C26-8753-B468B02CBA84\
        [0F64:0EC4][2015-12-23T09:49:26]i372: Session end, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{10569041-3f7b-4637-80ae-53dd6f8aed08}, resume: ARP, restart: None, disable resume: No
        [0F64:0EC4][2015-12-23T09:49:26]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{10569041-3f7b-4637-80ae-53dd6f8aed08}, resume: ARP, restart initiated: No, disable resume: No
        [260C:1A7C][2015-12-23T09:49:26]i000: MUX: Apply Complete: Disk Space Used in bytes for Installation: MaxAppDrive: 0 MaxSysDrive: 353177600 AppDrive: 0 SysDrive: 0
        [260C:1A7C][2015-12-23T09:49:26]i000: MUX: Free Disk Space after install: SystemDrive C:\ 76119216128 bytes AppDrive C:\ 76119216128 bytes
        [260C:1A7C][2015-12-23T09:49:26]i000: MUX: Go to Finished page.
        [260C:1A7C][2015-12-23T09:49:26]i000: MUX: Watson Bucketting Parameters
        [260C:1A7C][2015-12-23T09:49:26]i000: MUX: P1 – vs_community
        [260C:1A7C][2015-12-23T09:49:26]i000: MUX: P2 – 14.0.23107.156
        [260C:1A7C][2015-12-23T09:49:26]i000: MUX: P3 – 14.0.23107
        [260C:1A7C][2015-12-23T09:49:26]i000: MUX: P4 – Install
        [260C:1A7C][2015-12-23T09:49:26]i000: MUX: P5 – vs_teamExplorerCore
        [260C:1A7C][2015-12-23T09:49:26]i000: MUX: P6 – Install
        [260C:1A7C][2015-12-23T09:49:26]i000: MUX: P7 – 0x80070643
        [260C:1A7C][2015-12-23T09:49:26]i000: MUX: P8 – There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor.
        [260C:1A7C][2015-12-23T09:49:26]i000: MUX: P9 –
        [260C:1A7C][2015-12-23T09:49:26]i399: Apply complete, result: 0x80070643, restart: None, ba requested restart: No

  7. Erich – I’m afraid that this appears to be a separate issue entirely from the config file problem. This limited section of the log file tells me that a particular package (vs_teamExplorerCore) failed. There could be a number of problems, but I can’t tell what they are with just this info. Would you mind collecting full setup logs and sharing them with me via email?
    To collect, launch collect.exe from http://aka.ms/vscollect. When it finishes, share %temp%\vslogs.zip with me via a site like OneDrive, Dropbox… [the file is usually too large to share by email].
    If you’re ok doing that, please feel free to email me a link to those logs at eric.knox@microsoft.com

      1. you can remove this package from
        C:\ProgramData\Package Cache\{08A73E96-1340-3A49-B502-87C42205380F}v14.0.24720\packages\vs_minshellinterop

        run “vs_minshellinterop.msi” right click mouse choose uninstall

  8. Hi Eric, thank you that you for caring about this. I’ve sent you screen shots and the devenv.exe.config file that I’m running with.

    1. Thanks for the note Peter. As I said in email, what you sent me looks like the correct config file, so I’ve sent you instructions on the next diagnostic step to try and figure out what’s happening on your machine.

  9. Visual Studio 2015 Update 3 also doesn’t allow me to see some templates (MVC related most of the time), Data Transformation Services errors and much more… I can’t use .net core. I’m downloading the SDK from the insider page, hopefully that will fix something (I’m on a Windows 10 enterprise inssider -fast ring- )

Leave a comment