Visual studio 2022 Offline installation Success But IDE Crash

JustGentle 21 Reputation points
2022-11-10T06:45:45.043+00:00

I create an offline installation of vs2022
with this command:
.\vs_community.exe
--layout D:\Downloads\Code\vs2022-offline
--add Microsoft.VisualStudio.Workload.ManagedDesktop
--add Microsoft.VisualStudio.Workload.NetWeb
--add Microsoft.VisualStudio.Workload.VisualStudioExtension
--add Microsoft.VisualStudio.Component.DiagnosticTools
--add Microsoft.VisualStudio.Component.WebDeploy
--includeOptional --lang zh-CN

then installed success and ask me to restart my computer.
after restart, i tried to run vs2022, and i crash without any message.
and i can't run vs installer any more, it crash the same way and the same error log
that I found in windows event log:

应用程序: devenv.exe

Framework 版本: v4.0.30319

说明: 由于未经处理的异常,进程终止。(Description: The process terminated due to an unhandled exception.)

异常信息: System.TypeLoadException

在 System.Windows.Automation.Peers.AutomationPeer.Initialize()

在 System.Windows.Automation.Peers.AutomationPeer..cctor()

异常信息*(exception)*: System.TypeInitializationException

(at) System.Windows.Automation.Peers.AutomationPeer.RaiseFocusChangedEventHelper(System.Windows.IInputElement)

在 System.Windows.Input.KeyboardDevice.ChangeFocus(System.Windows.DependencyObject, Int32)

在 System.Windows.Input.KeyboardDevice.TryChangeFocus(System.Windows.DependencyObject, System.Windows.Input.IKeyboardInputProvider, Boolean, Boolean, Boolean)

在 System.Windows.Input.KeyboardDevice.Focus(System.Windows.DependencyObject, Boolean, Boolean, Boolean)

在 System.Windows.Input.KeyboardDevice.Focus(System.Windows.IInputElement)

在 System.Windows.Interop.HwndKeyboardInputProvider.OnSetFocus(IntPtr)

在 System.Windows.Interop.HwndKeyboardInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)

在 System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)

在 MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)

在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)

在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)

在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)

在 System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)

在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)

Developer technologies | Visual Studio | Setup
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 34,456 Reputation points Microsoft External Staff
    2022-12-01T09:09:35.463+00:00

    Hi @JustGentle ,

    Do you mean you first installed v17.2.6 and it worked well, after that you installed v17.4.0, but since then VS 2022 v17.4.0 and VS Installer crashed?

    If so, I suspect there are some conflicts. Does VS 2022 v17.2.6 still exist on your machine?

    If it(VS 2022 v17.2.6) was removed, then you can try to reinstall VS. To reinstall VS, you need to uninstall it. Since VS Installer doesn’t work, you can use two methods to uninstall it, one is using InstallCleanup.exe tool(it is always located at %ProgramFiles(x86)%\Microsoft Visual Studio, see this document: Remove all with InstallCleanup.exe for more details). The other is manually removing VS. You need to remove following folders: C:\Program Files\Microsoft Visual Studio, the layout folder and perhaps this folder(if it exists): %programdata%\Microsoft\visualstudio\packages. And then please remove following Registry Keys(back up the Registry first just in case, and remove them carefully as Registry Keys are very important): HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\VisualStudio\Setup, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\Setup. After successfully removing VS, you can then retry installing it.

    If it(VS 2022 v17.2.6) still exists on your machine, probably there are some conflicts. Since there’s only one VS Installer on your machine and it crashed, you may need to follow steps above to uninstall one of them or both of them and then reinstall the specific version of VS again.(BTW, if you just need to update the offline installed VS, you don’t need to install a new version of VS 2022, you just need to update the layout and then update VS 2022 in VS Installer)

    Feel free to let me know if above suggestions work for you.

    Best Regards,
    Tianyu

    • If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. JustGentle 21 Reputation points
    2022-12-12T08:17:32.617+00:00

    The operating system function is corrupted or conflicts with VS, and it can be solved by updating to 22H2 or newer

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.