Skip to content

Commit

Permalink
Fix C# project creation logic to handle 'netcoreapp' (#754)
Browse files Browse the repository at this point in the history
Looks like C# project used to default to 'netstandard2.0' and now they default to 'netcoreapp2.1'
  • Loading branch information
ejizba authored Oct 22, 2018
1 parent 930ffc0 commit eba0da0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/commands/createNewProject/CSharpProjectCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class CSharpProjectCreator extends ProjectCreatorBase {
} else {
const targetFramework: string = matches[1];
this.telemetryProperties.cSharpTargetFramework = targetFramework;
if (targetFramework.startsWith('netstandard')) {
if (/net(standard|core)/i.test(targetFramework)) {
this._runtime = ProjectRuntime.v2;
} else {
this._runtime = ProjectRuntime.v1;
Expand Down
4 changes: 2 additions & 2 deletions test/createNewProject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ suite('Create New Project Tests', async function (this: ISuiteCallbackContext):
await validateVSCodeProjectFiles(projectPath);
const projectName: string = path.basename(projectPath);
assert.equal(await fse.pathExists(path.join(projectPath, `${projectName}.csproj`)), true, 'csproj does not exist');
await validateSetting(projectPath, `${extensionPrefix}.${deploySubpathSetting}`, 'bin/Release/netstandard2.0/publish');
await validateSetting(projectPath, `${extensionPrefix}.${deploySubpathSetting}`, 'bin/Release/netcoreapp2.1/publish');
});

const bashProject: string = 'BashProject';
Expand Down Expand Up @@ -150,7 +150,7 @@ suite('Create New Project Tests', async function (this: ISuiteCallbackContext):
const projectPath: string = path.join(testFolderPath, 'createNewProjectApiCSharp');
ext.ui = new TestUserInput([DialogResponses.skipForNow.title]);
await vscode.commands.executeCommand('azureFunctions.createNewProject', projectPath, 'C#', '~2', false /* openFolder */, templateId, functionName, { namespace: namespace, Path: iotPath, Connection: connection });
await validateSetting(projectPath, `${extensionPrefix}.${deploySubpathSetting}`, 'bin/Release/netstandard2.0/publish');
await validateSetting(projectPath, `${extensionPrefix}.${deploySubpathSetting}`, 'bin/Release/netcoreapp2.1/publish');
});

async function testCreateNewProject(projectPath: string, language: string, previewLanguage: boolean, ...inputs: (string | undefined)[]): Promise<void> {
Expand Down

0 comments on commit eba0da0

Please sign in to comment.