Skip to content

Instantly share code, notes, and snippets.

@olned
Last active August 29, 2020 12:22
Show Gist options
  • Save olned/958cff085e5771a10f7d310b95aae83b to your computer and use it in GitHub Desktop.
Save olned/958cff085e5771a10f7d310b95aae83b to your computer and use it in GitHub Desktop.
C# Create .Net ConsoleApp
#!/bin/bash
set -ex;
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd ${DIR}
SLNNAME=${PWD##*/}
APPNAME=src/${SLNNAME}App
LIBNAME=src/${SLNNAME}Lib
TESTNAME=test/${SLNNAME}.Tests
dotnet new sln
dotnet new classlib -o ${LIBNAME}
dotnet sln add ${LIBNAME}
dotnet new console -o ${APPNAME}
dotnet add ${APPNAME} reference ${LIBNAME}
dotnet sln add ${APPNAME}
dotnet new xunit -o ${TESTNAME}
dotnet add ${TESTNAME} reference ${LIBNAME}
dotnet sln add ${TESTNAME}
@olned
Copy link
Author

olned commented Aug 25, 2020

Example of script execution

git clone [email protected]:958cff085e5771a10f7d310b95aae83b.git HelloWorld
cd HelloWorld
chmod +x create_console_app.sh
./create_console_app.sh
rm create_console_app.sh

Run App

dotnet run --project src/HelloWorldApp

Run Test

dotnet test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment