An ZSH Shell script to take the donkey work out of creating a Dot Net Console project
for VS Code on MacOs, Linux and windows or Visual Studio on Windows.
Request Feature
·
Report Bug
If you create a lot of cross platform CLI tools using Dot Net Core, you might find this project creation script a useful head start.
The script does the following:
- Creates a root project folder
- Creates a git repo for the project
- Creates a git ignore file that is populated with all the recommended file that should be ignored by the repo for a Dot Net project.
- Creates a Dot Net C# project in a subfolder
- Creates a xUnitTest project in a separate subfolder
- Creates a Visual Studio solution (.sln) file and adds the Dot Net project and the xUnitTest project to it. This is not needed if you are developing exclusively in VS Code, but it is useful if developing in Visual Studio on Windows.
- Downloads an initial readme.md file and add it to the project folder.
- Downloads a License file and add it to the project. This is a MIT license. If you want to use a GNU license, you can download it from https://choosealicense.com/licenses/gpl-3.0/#
- Tests the initial project compiles and commits the initial files to the repo as the project starting point.
- Clone the Create Dot Net Project repo and copy the CreateConsoleProject.zsh file to a place that is easy for you to run in a terminal, such as the root folder of your source code development folder.
The script assumes that the following are already installed in your developer environment, as it will use this tools to create and setup the Dot Net project ready for software development.
- git
- Dot Net Core
- ZSH shell
- curl (This is already included in the ZSH shell if using MacOS Terminal.)
-
Open a ZSH terminal and run the script giving the name of the project as the first parameter
./CreateConsoleProject.zsh NewProjectName
If you want the project root folder to be a different name than the name of the project (.csproj) then give the root folder name as a second parameter. If only one parameter name is given, then it is used as both the project and the root folder name.
./CreateConsoleProject.zsh NewProjectName NewProjectRootFolderName
If you are using a powershell terminal to run the script, please be aware that Microsoft implemented a powershell version of curl that shares the same name but is not the same as the real curl command line tool. Windows has shipped with the real curl tool since the early 2000's. The script is intended to use the real curl tool, not Microsofts powershell version. See https://curl.se for more information.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See license.txt for more information.
Project Link: https://github.com/Software101DotNet/CreateDotNetProject