C# Local Environment Setup
Prerequisites
The steps in this article are to be carried out after an app has been created and cloned to your local environment.
Software Downloads
Required Software
Recommended Software
- Visual Studio - For editing C# code
- Visual Studio Code - For editing Typescript code
Database
By default, an app made with Codebots will use a PostgreSQL database. If your application was created using the Generate tool, and you specified a database other than the default (Postgres), use the database provider you selected instead.
- PostgreSQL (default)
- MySQL
- SQL Server
- 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 you are setting up a new database provider, all Codebots’ applications default to username: user
and password: pass
when trying to connect.
If you are using an existing database provider, you can configure your database connection by altering 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; navigate to the
clientside
directory and runnpm install -g yarn
followed byyarn install
. - Navigate to
serverside/src/
and rundotnet build
. - An initial database migration must be created; navigate to
serverside/src
and rundotnet ef migrations add InitialMigration
. - Now the migration needs to be applied to the database; still in the
serverside/src
directory, rundotnet ef database update
. This will create the database and all of the tables. - At this point the server should be ready to run; still in the
serverside/src
directory, rundotnet run
. - You can now access the server by navigating to http://localhost:5000/ in your web browser.
Configuration
IDE
By default an 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 command in the same directory as the sln file:
dotnet sln add testtarget/API testtarget/Serverside testtarget/TestDataLib testtarget/Selenium serverside/src
Now the sln file can be opened in an IDE such as Visual Studio or Rider.
Was this article helpful?