I wanted to use a bash script to generate code for a project using dotnet core on Linux. Here is what worked for me. And thanks @stukselbax, I built this off of your answer.
Note that the script I'm using to generate the code is called generatecode.sh. Replace this with your own.