Before you can run a .NET application, you need to install the .NET SDK. To install the latest .NET 7 SDK, follow these steps:
- Visit the .NET 7 SDK download page.
- Choose the SDK that corresponds to your operating system.
- Click on the download link and run the installer.
- Follow the instructions in the installer.
You can verify the installation by opening a new command prompt or terminal window and running the command dotnet --version
. This should display the version of the .NET SDK that you installed. If you installed it correctly, it should show a version number starting with 7.X.X
.
You have the flexibility to develop this project using one of the recommended IDEs below, or feel free to use your preferred IDE:
- Visual Studio Code: This is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS, and Linux. You can download it from the official Visual Studio Code page.
- After installing Visual Studio Code, open the project folder by clicking on
File -> Open Folder
.
- Visual Studio: This is a full-featured IDE that runs on Windows and macOS. You can download it from the official Visual Studio page.
- After installing Visual Studio, open the project by clicking on
File -> Open -> Project/Solution
and selecting the.sln
file of your project.
- JetBrains Rider: This is a fast and powerful .NET IDE developed by JetBrains. It runs on Windows, macOS, and Linux. You can download it from the official JetBrains Rider page.
- After installing Rider, open the project by clicking on
File -> Open
and selecting the.sln
file of your project.
⚠️ Important! Before running the application, make sure you have set up your environment correctly. You must have read the Managing Secrets with User-Secrets and Generating a GitHub Access Token sections.
-
Clone the repository: Use the
git clone
command followed by the URL of the repository. This will create a local copy of the project on your machine. -
Navigate to the project directory: Use the
cd
command followed by the path of the directory. For example, if the project is in a directory namedsrc/CrystallineSociety
, you would use the commandcd src/CrystallineSociety
. -
Run the web app: Navigate to the
Client/App
directory within the project directory. Use thedotnet run
command to start the web app. This command will build the project and start running the web server. -
Run the API app: Navigate to the
Server
directory within the project directory. Use thedotnet run
command to start the API app. This command will build the project and start running the API server.
.NET provides a secrets manager tool that can be used for storing sensitive data during the development of a project. This tool stores sensitive data in a separate secrets.json file that is not checked into source control, unlike the appsettings.json
file.
Here's how you can use the secrets manager:
- Install the Secret Manager tool globally: Run the following command in your terminal:
dotnet tool install --global dotnet-user-secrets
- Navigate to your API project directory: Use the
cd
command to navigate to the directory of your API project. If your API project is located in a folder namedServer
inside thesrc/CrystallineSociety
directory, you would use the following command:
cd src/CrystallineSociety/Server
- Initialize the secrets storage: Run the following command:
dotnet user-secrets init
- Set the secrets: Use the
dotnet user-secrets set
command to set your secrets. For example:
⚠️ Important! You will need to generate your own GitHub Access Token. Instructions on how to do this will be provided in the next section. For the SQL Server Connection String, you can request access to the Telegram group that contains the connection string. You can join the group using this link.
dotnet user-secrets set "ConnectionStrings:SqlServerConnectionString" "Your SQL Server Connection String"
dotnet user-secrets set "GitHub:GitHubAccessToken" "Your GitHub Access Token"
Remember to replace "Your SQL Server Connection String"
and "Your GitHub Access Token"
with your actual connection string and access token.
This way, your secrets are kept out of your project files and won't be checked into source control. For more information on managing application secrets during development with User Secrets, you can visit the official Microsoft documentation here.
A GitHub access token is a way to authenticate with GitHub without using a password. You can generate a new token as follows:
-
Go to your GitHub settings: Click on your profile picture in the top right corner of the GitHub homepage, then click on
Settings
. -
Navigate to
Developer settings
: This is located at the bottom of the settings sidebar. -
Click on
Personal access tokens
: This will take you to a page where you can see a list of your existing tokens. -
Generate a new token: Click on the
Generate new token
button. You will be asked to enter your password. -
Name your token: Enter a descriptive name in the
Note
field to help you remember what the token is for. -
Set the scopes: Check the boxes for the scopes, or permissions, you want to grant this token. For example, if you want the token to be able to access your repositories, you would check the
repo
box. -
Generate the token: Click the
Generate token
button at the bottom of the page. Your new token will be created. -
Copy the token: After generating the token, make sure to copy it. You won't be able to see it again. Use the .NET user-secrets tool to store your new token. Run the following command in your terminal, replacing
"Your GitHub Access Token"
with your new token:
dotnet user-secrets set "GitHub:GitHubAccessToken" "Your GitHub Access Token"
For more detailed information, you can visit the official GitHub documentation on Managing Your Personal Access Tokens.