diff --git a/src/main.ts b/src/main.ts index 1e73f241e..bc862ac33 100644 --- a/src/main.ts +++ b/src/main.ts @@ -32,7 +32,7 @@ export function activate(context: vscode.ExtensionContext): any { ensureRuntimeDependencies(extension, logger, reporter) .then((success : boolean) => { // activate language services - OmniSharp.activate(context, reporter); + OmniSharp.activate(context, reporter, _channel); // register JSON completion & hover providers for project.json context.subscriptions.push(addJSONProviders()); diff --git a/src/omnisharp/extension.ts b/src/omnisharp/extension.ts index eb13b2598..0c3186af8 100644 --- a/src/omnisharp/extension.ts +++ b/src/omnisharp/extension.ts @@ -30,7 +30,7 @@ import { addAssetsIfNecessary, AddAssetResult } from '../assets'; import { sum, safeLength } from '../common'; import * as utils from './utils'; -export function activate(context: vscode.ExtensionContext, reporter: TelemetryReporter) { +export function activate(context: vscode.ExtensionContext, reporter: TelemetryReporter, channel: vscode.OutputChannel) { const documentSelector: vscode.DocumentSelector = { language: 'csharp', scheme: 'file' // only files from disk @@ -88,6 +88,25 @@ export function activate(context: vscode.ExtensionContext, reporter: TelemetryRe })); } + // After server is started (and projects are loaded), check to see if there are + // any project.json projects. If so, notify the user about migration. + disposables.push(server.onServerStart(() => { + utils.requestWorkspaceInformation(server) + .then(workspaceInfo => { + if (workspaceInfo.DotNet && workspaceInfo.DotNet.Projects.length > 0) { + const shortMessage = 'project.json is no longer a supported project format for .NET Core applications.'; + const detailedMessage = "Warning: project.json is no longer a supported project format for .NET Core applications. Update to the latest version of .NET Core (https://aka.ms/netcoredownload) and use ‘dotnet migrate’ to upgrade your project (see https://aka.ms/netcoremigrate for details)."; + const moreDetailItem: vscode.MessageItem = { title: 'More Detail' }; + + vscode.window.showWarningMessage(shortMessage, moreDetailItem) + .then(item => { + channel.appendLine(detailedMessage); + channel.show(); + }); + } + }); + })); + // Send telemetry about the sorts of projects the server was started on. disposables.push(server.onServerStart(() => { let measures: { [key: string]: number } = {};