I am using .net cli 2.0.3 and I was wondering if it is possible to load my arguments from file i.e.
dotnet publish -args somefile
Where somefile
will contain the arguments which the certain command accepts.
For example, while publishing I want to have predefined path\project.csproj -c Release -o "outputpath"
I know that there isn't that kind of command in the sdk, but is there a way that I can achieve it ?
Best regards!
While the CLI itself doesn't have a mechanism to load response files, it calls out to MSBuild which does support both specified response files and the following automatic response files:
MSBuild.rsp
next to the project / solution file to buildDirectory.Build.rsp
in the hierarchy at or above the project / solution file to buildWhile you cannot specify CLI arguments, you can specify their equivalent MSBuild arguments.
For example you can create a release.rsp
next to your solution file that specifies:
-p:Configuration=Release
-p:OutputPath=..\rel-out\
-p:PublishDir=..\pub-out\
Which you could use to call
dotnet publish test\project.csproj @release.rsp
If the same file was named Directory.Build.rsp
, it would have been applied automatically.
If would also have been applied autoamatically if it was named MSbuild.rsp
and put it next to the csproj file.