This is an instructional on how to setup your environment for C#Bot development.
Prerequisites
- These steps are to be carried out after a project has been created and cloned to your local environment.
Required Software
Mandatory Software
Recommended Software
- Visual Studio - For editing C# code
- Visual Studio Code - For editing Typescript code
Database
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.
- PostgreSQL
-
- 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
clientside
directory and runnpm install -g yarn
followed byyarn install
. - Navigate to
serverside/src/
and rundotnet build
- Next an initial database migration must be created. Navigate to
serverside/src
and rundotnet ef migrations add InitialMigration
. - Next the migration needs to be applied to the database. In the
serverside/src
directory rundotnet ef database update
. This step shall make the database and all of the tables. - Now the server should be ready to run, in the
serverside/src
directory rundotnet run
. - You can now access the server by navigating to http://localhost:5000/ in your web browser of choice
Configuration
IDE
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.