Created
September 21, 2023 12:12
-
-
Save Smartis2812/81e1bdf69c5b444cd59f02eebcb7a764 to your computer and use it in GitHub Desktop.
Bash script for creating a dotnet solution with console and dll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get the name from the input | |
name=$1 | |
# Create Output folder from name and move into it | |
mkdir $name | |
cd $name | |
# Create a new solution | |
dotnet new sln -n $name | |
# Navigate to the solution directory | |
cd $name | |
# Create a class library | |
dotnet new classlib -n $name | |
# Create a console application | |
dotnet new console -n "${name}App" | |
# Add the class library to the solution | |
dotnet sln add "${name}/${name}.csproj" | |
# Add the console application to the solution | |
dotnet sln add "${name}App/${name}App.csproj" | |
# Add reference of the class library to the console application | |
dotnet add "${name}App/${name}App.csproj" reference "${name}/${name}.csproj" | |
# Initialize a new git repository | |
git init | |
# Create a .gitignore file | |
dotnet new gitignore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment