In the Visual Studio Task Runner Explorer, I can bind 'Run - Development' to 'After Build' and this works very well. I can also bind 'Run - Production' to 'After Build' and this will also work.
What I want to be able to do, is have 'Run - Development' execute when I'm in Debug mode, and have 'Run - Production' execute when I'm in Release mode.
How do I make this happen?
There's a nuget package that you can install that allows you to run npm commands.
Then you can add two different commands to your package.json
file, like so:
"scripts": {
"webpack": "webpack",
"webpack-prd": "webpack -p"
},
After having the nuget package installed you edit your .csproj file to run the npm commands configured. Here's how I did:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<NpmCommand>run webpack</NpmCommand>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<NpmCommand>run webpack-prd</NpmCommand>
</PropertyGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With