Hi Everyone!
Currently I am running the command below on my CI/CD pipeline, everything is working as expected.
& dotnet publish "$projectSolution" --output $outputDir --configuration $Configuration /p:EnvironmentName=$Environment --verbosity quiet
This will generate the following web.config file
="1.0"="utf-8"
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\{projectSolution}.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</location>
</configuration>
However, I wanted to add a command line argument to the arguments in the web.config file in the
aspNetCore node. So if I add the argument manually
<aspNetCore processPath="dotnet" arguments=".\{projectSolution}.dll new_argument" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
The code will work, but I don't know how to add the argument
new_argument using the
dotnet publish command so that the file is automatically generated with the argument added. Any help is greatly appreciated.
What I have tried:
I have looked over many times about adding arguments from the documentation
dotnet run command - .NET CLI | Microsoft Docs[
^] but to no avail.