Skip to content

Commit

Permalink
Merge pull request #1545 from adamhartford/master
Browse files Browse the repository at this point in the history
Fix Restore Packages command when targeting .NET Framework. Issue #1507.
  • Loading branch information
DustinCampbell authored Jun 6, 2017
2 parents 1575d65 + ff66bf9 commit 1311f36
Showing 1 changed file with 12 additions and 2 deletions.
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

0 comments on commit 1311f36

Please sign in to comment.