Skip to content

Commit

Permalink
Fix dotnetCoreCliV2 run command (#10753)
Browse files Browse the repository at this point in the history
* Fix dotnetCoreCliV2 run command

* Taking into account scenario when project files are not specified and meant to run command in CWD
  • Loading branch information
vineetmimrot committed Jun 27, 2019
1 parent f59d575 commit 45a505a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion Tasks/DotNetCoreCLIV2/dotnetcore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,14 @@ export class dotNetExe {
var projectFile = projectFiles[fileIndex];
var dotnet = tl.tool(dotnetPath);
dotnet.arg(this.command);
dotnet.arg(projectFile);
if (this.isRunCommand()) {
if (!!projectFile) {
dotnet.arg("--project");
dotnet.arg(projectFile);
}
} else {
dotnet.arg(projectFile);
}
var dotnetArguments = this.arguments;
if (this.isPublishCommand() && this.outputArgument && tl.getBoolInput("modifyOutputPath")) {
var output = dotNetExe.getModifiedOutputForProjectFile(this.outputArgument, projectFile);
Expand Down Expand Up @@ -345,6 +352,10 @@ export class dotNetExe {
return this.command === "publish";
}

private isRunCommand(): boolean {
return this.command === "run";
}

private static getModifiedOutputForProjectFile(outputBase: string, projectFile: string): string {
return path.join(outputBase, path.basename(path.dirname(projectFile)));
}
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DotNetCoreCLIV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 2,
"Minor": 154,
"Patch": 5
"Patch": 6
},
"minimumAgentVersion": "2.115.0",
"instanceNameFormat": "dotnet $(command)",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DotNetCoreCLIV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 2,
"Minor": 154,
"Patch": 5
"Patch": 6
},
"minimumAgentVersion": "2.115.0",
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
Expand Down

0 comments on commit 45a505a

Please sign in to comment.