Skip to content

Commit 2efafa8

Browse files
authored
Adding support for running dotnet run after installing core tools thru npm (#3127)
* adding windows target * updating release notes * addressing comments
1 parent fe00d7c commit 2efafa8

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

sdk/Sdk/Targets/Microsoft.Azure.Functions.Worker.Sdk.targets

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,19 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
106106
<Error Condition="'$(_ToolingSuffix)' == ''" Text="Invalid combination of TargetFramework and AzureFunctionsVersion is set." />
107107
</Target>
108108

109-
<!-- This target is used to set up the run arguments for the function app, supporting `dotnet run` -->
110109
<Target Name="_FunctionsComputeRunArguments" BeforeTargets="ComputeRunArguments" DependsOnTargets="_FunctionsCheckForCoreTools">
111-
<PropertyGroup Condition="'$(FuncExists)' == 'true'">
112-
<RunCommand>func</RunCommand>
113-
<RunArguments>host start $(RunArguments)</RunArguments>
114-
<RunWorkingDirectory>$(OutDir)</RunWorkingDirectory>
110+
<!-- Windows Configuration -->
111+
<PropertyGroup Condition="'$(OS)' == 'Windows_NT'">
112+
<RunCommand>cmd</RunCommand>
113+
<RunArguments>/C func start $(RunArguments)</RunArguments>
114+
<RunWorkingDirectory>$(OutDir)</RunWorkingDirectory>
115+
</PropertyGroup>
116+
117+
<!-- Unix/Linux/macOS Configuration -->
118+
<PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
119+
<RunCommand>func</RunCommand>
120+
<RunArguments>start $(RunArguments)</RunArguments>
121+
<RunWorkingDirectory>$(OutDir)</RunWorkingDirectory>
115122
</PropertyGroup>
116123
</Target>
117124

sdk/release_notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
### Microsoft.Azure.Functions.Worker.Sdk <version>
88

99
- Build no longer generates `functions.metadata` if source-generated metadata provider is enabled. (#2974)
10+
- Fixing `dotnet run` to work on Windows when core tools is installed from NPM (#3127)
1011

1112
### Microsoft.Azure.Functions.Worker.Sdk.Generators <version>
1213

0 commit comments

Comments
 (0)