Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Restore Packages command when targeting .NET Framework. Issue #1507. #1545

Merged
merged 2 commits into from
Jun 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/omnisharp/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,11 @@ export namespace V2 {
}
}

export function findNetFrameworkTargetFramework(project: MSBuildProject): TargetFramework {
let regexp = new RegExp('^net[1-4]');
return project.TargetFrameworks.find(tf => regexp.test(tf.ShortName));
}

export function findNetCoreAppTargetFramework(project: MSBuildProject): TargetFramework {
return project.TargetFrameworks.find(tf => tf.ShortName.startsWith('netcoreapp'));
}
Expand All @@ -573,6 +578,12 @@ export function findNetStandardTargetFramework(project: MSBuildProject): TargetF
return project.TargetFrameworks.find(tf => tf.ShortName.startsWith('netstandard'));
}

export function isDotNetCoreProject(project: MSBuildProject): Boolean {
return findNetCoreAppTargetFramework(project) !== undefined ||
findNetStandardTargetFramework(project) !== undefined ||
findNetFrameworkTargetFramework(project) !== undefined;
}

export interface ProjectDescriptor {
Name: string;
Directory: string;
Expand All @@ -594,8 +605,7 @@ export function getDotNetCoreProjectDescriptors(info: WorkspaceInformationRespon

if (info.MsBuild && info.MsBuild.Projects.length > 0) {
for (let project of info.MsBuild.Projects) {
if (findNetCoreAppTargetFramework(project) !== undefined ||
findNetStandardTargetFramework(project) !== undefined) {
if (isDotNetCoreProject(project)) {
result.push({
Name: path.basename(project.Path),
Directory: path.dirname(project.Path),
Expand Down