C# Local Environment Setup
By Jack Kerr and Tessa Holland 16 December 2019 Techies
This is an instructional on how to setup your environment for C#Bot development.
- These steps are to be carried out after a project has been created and cloned to your local environment.
Depending on the project, an SQL Server or PostgreSQL database may be used. For either database, a user name of
test and password of
pass will be required. By default, a project on Codebots will use a Postgres database.
- When configuring the server, ensure there is a SQL Server (not Windows User) user with the above credentials.
- Ensure that TCP connections to the database are enabled
If the user for the database is not set up as specified then alter the connection string in
serverside/src/appsettings.Development.xml. You do not need to create the database for the server, at this stage, it will be created later.
First time setup
It is important to note that if these steps are being done on Linux, you should not
sudo these commands, or otherwise there shall be file ownership issues later.
- First the client-side needs to have its packages installed. To do so navigate to the
clientsidedirectory and run
npm install -g yarnfollowed by
- Navigate to
- Next an initial database migration must be created. Navigate to
dotnet ef migrations add InitialMigration.
- Next the migration needs to be applied to the database. In the
dotnet ef database update. This step shall make the database and all of the tables.
- Now the server should be ready to run, in the
- You can now access the server by navigating to http://localhost:5000/ in your web browser of choice
By default a sln file is not created, but this can be fixed from the dotnet command line.
- In the root project directory run
dotnet new sln
- To add the dependent projects to the solution run the following commands in the same directory as the sln file
dotnet sln add serverside/src/[YOUR PROJECT NAME].csproj
dotnet sln add testtarget/Serverside/[YOUR PROJECT NAME]Test.csproj
dotnet sln add testtarget/Selenium/SeleniumTests.csproj
Now the sln file can be opened in an IDE such as Visual Studio or Rider.