@@ -41,7 +41,7 @@ import {
41
41
42
42
import { ExtensionHost } from "./ExtensionHost.js" ;
43
43
import { webSession } from "../../frontend/src/supplement/WebSession.js" ;
44
- import { setupInitialWelcomeWebview } from "./WebviewProviders/WelcomeWebviewProvider.js" ;
44
+ import { checkVcRuntime , setupInitialWelcomeWebview } from "./WebviewProviders/WelcomeWebviewProvider.js" ;
45
45
import { waitFor } from "../../frontend/src/utilities/helpers.js" ;
46
46
import { MessageScheduler } from "../../frontend/src/communication/MessageScheduler.js" ;
47
47
@@ -288,9 +288,10 @@ export const activate = (context: ExtensionContext): void => {
288
288
const lastRunVersion = context . globalState . get ( "MySQLShellLastRunVersion" ) ;
289
289
if ( ! lastRunVersion || lastRunVersion === "" || lastRunVersion !== currentVersion ) {
290
290
void context . globalState . update ( "MySQLShellLastRunVersion" , currentVersion ) ;
291
+ const osName = platform ( ) ;
291
292
292
293
// Reset extended attributes on macOS
293
- if ( platform ( ) === "darwin" ) {
294
+ if ( osName === "darwin" ) {
294
295
const shellDir = join ( context . extensionPath , "shell" ) ;
295
296
if ( existsSync ( shellDir ) ) {
296
297
// cSpell:ignore xattr
@@ -301,6 +302,29 @@ export const activate = (context: ExtensionContext): void => {
301
302
// cSpell:ignore xattr
302
303
void childProcess . execSync ( `xattr -rc ${ routerDir } ` ) ;
303
304
}
305
+ } else if ( osName === "win32" ) {
306
+ const promptForVcUpdate = ( ) => {
307
+ // cSpell:ignore redist msvc
308
+ void window . showErrorMessage (
309
+ "The Microsoft Visual C++ Redistributable needs to be updated and VS Code needs to be " +
310
+ "restarted. Do you want to open the Microsoft download page?" ,
311
+ "Open Download Page" , "Cancel" ) . then ( ( answer ) => {
312
+ if ( answer !== "Cancel" ) {
313
+ void env . openExternal ( Uri . parse (
314
+ "https://learn.microsoft.com/en-us/cpp/windows/" +
315
+ "latest-supported-vc-redist?view=msvc-170" ) ) ;
316
+ }
317
+ } ) ;
318
+ } ;
319
+
320
+ checkVcRuntime ( ) . then ( ( result : boolean ) => {
321
+ if ( ! result ) {
322
+ promptForVcUpdate ( ) ;
323
+ }
324
+ } ) . catch ( ( reason ) => {
325
+ printChannelOutput ( String ( reason ) , true ) ;
326
+ promptForVcUpdate ( ) ;
327
+ } ) ;
304
328
}
305
329
}
306
330
0 commit comments