Hide

YetaWF Documentation

Display
Print

Installing YetaWF for .NET on Windows

YetaWF uses .NET 6.0. Visual Studio 2022 is required, we always use the most current (non-preview) version. Earlier versions may not work if they don't yet support the .NET version used by YetaWF.

Installing Visual Studio 2022

Visual Studio 2022 17.1.5+ is required to build YetaWF with .NET 6.0 - MVC.

.NET SDK

In order to build YetaWF, the .NET SDK is required. It can be downloaded and installed from https://dotnet.microsoft.com/download.

Git

In order to clone the Git repository you'll need the Git Windows tools. If these are not present on your development system you can install them from https://git-for-windows.github.io/.

nodejs

Nodejs and npm are used by YetaWF for the build pipeline and JavaScript package management. Nodejs, which includes npm, can be downloaded and installed from https://nodejs.org.

YetaWF was tested with nodejs 10.15.3 LTS, gulp >4.

Gulp

Gulp can be installed from the command line:

npm install -g gulp

It also requires the latest version of gulp-cli.

npm install gulp-cli --global

VS 2022 External Tools Paths

Visual Studio 2022 installs an older version of npm which can conflict with the latest version, which is needed for YetaWF.

Using Visual Studio 2022, open the Options dialog using the menu > Tools > Options. Select External Web Tools, part of the Projects and Solutions section.

Move the $(PATH) entry ahead of $(VSINSTALLDIR)\Web\External and any other entries referencing $(VSINSTALLDIR).

Options Dialog

Clone The YetaWF Depot

Open a Windows Command Prompt and create an appropriate folder on your development system. Then make the new folder the current directory:

mkdir \Sites\YetaWFTest
cd \Sites\YetaWFTest

Clone the YetaWF Solution2 repository (make sure to include the trailing period in the clone statement to indicate the current folder) and retrieve all the required submodules:

git clone --recursive https://github.com/YetaWF/YetaWF-Solution2 .

Important: Once completed, run the following command which creates the required symlinks and additional JavaScript packages are downloaded/installed:

post-clone.bat

The above executes the following statements so you don't have to enter them manually.

PublicTools\ProjectSettings\bin\Windows\Softelvdm.ProjectSettings.exe Symlinks
cd Website
cmd /c npm install
cd ..

Opening The Solution

Once the repository has been cloned and all steps completed, the solution file can be opened using Visual Studio. The solution file is named YetaWFDist5.com.sln.

Do not run the web project until after deciding whether to use files or a database server below.

Rebuild all (make sure that the Nuget Package Manager is set to automatically download missing packages) to build your new site. Please be patient while all packages are restored (there is little visual feedback).

Files Or Database Server

The default installation can run as-is and will create data files. This is intended for use with small sites (few pages or users) and for initial testing.

If you want to use files for data storage, you're ready to run the Website project. This will start your new website. Otherwise, for large scale use, it is recommended to use a database to store all site data.

Microsoft SQL Server

In order to use a SQL database, the connection string has to be specified in the AppSettings.json file.

AppSettings.json

The SQL DB is defined in AppSettings.json (located in folder ./Website/Data).

First, in the "Default" section, change the IOMode setting to "SQL".

Then add the connection string, by removing "notused_" (part of the SQLDbo and SQLConnect keys) and provide the connection string ("Data Source= ....").

      . . .
      "Default": {
        "LanguageId": "en-US",
        "IOMode": "File",
        "notused_SQLDbo": "dbo",
        "notused_SQLConnect": "Data Source=....;Initial Catalog=....;User ID=username;Password=password;TrustServerCertificate=True",
        . . .

AppSettings.json shown with connection string ("Data Source=") which you would provide.

      . . .
      "Default": {
        "LanguageId": "en-US",
        "IOMode": "SQL",                    <<<<<< CHANGED
        "SQLDbo": "dbo",                    <<<<<< CHANGED
        "SQLConnect": "Data Source=yoursource;Initial Catalog=yourcatalog;User ID=yourusername;Password=yourpassword;TrustServerCertificate=True",  <<<<<< CHANGED
        . . .

The DB itself has to be created in SQL (usually with SQL Server Management Studio). Once the DB has been created, the site can be rebuilt and started. All tables will be created automatically during site startup.

PostgreSQL Server

In order to use a PostgreSQL database, the connection string has to be specified in the AppSettings.json file.

AppSettings.json

The PostgreSQL DB is defined in AppSettings.json (located in folder ./Website/Data).

First, in the "Default" section, change the IOMode setting to "PostgreSQL".

Then add the connection string, by removing "notused_" (part of the PostgreSQLSchema and PostgreSQLConnect keys) and provide the connection string ("Host=...").

      . . .
      "Default": {
        "LanguageId": "en-US",
        "IOMode": "File",
        . . .
        "notused_PostgreSQLSchema": "public",
        "notused_PostgreSQLConnect": "Host=...;Port=5432;Username=...;Password=...;Database=...",
        . . .

AppSettings.json shown with connection string ("Data Source=") which you would provide.

      . . .
      "Default": {
        "LanguageId": "en-US",
        "IOMode": "PostgreSQL",             <<<<<< CHANGED
        . . .
        "PostgreSQLSchema": "public",       <<<<<< CHANGED
        "PostgreSQLConnect": "Host=yourhost;Port=5432;Username=yourusername;Password=yourpassword;Database=databasename",  <<<<<< CHANGED
        . . .

The DB itself has to be created in PostgreSQL (usually with pgAdmin). Once the DB has been created, the site can be rebuilt and started. All tables will be created automatically during site startup.

Running The Web Project

When you open your Visual Studio solution for the very first time, please wait a moment until all project references are downloaded and resolved. If you start a build too early, the build will fail (this appears to be a bug in Visual Studio). If this happens, simply "Rebuild All" again.

For first time startup of the site, make sure to build a Debug build (but don't run the debugger when starting the site).

Once all of the above steps have been completed, the Website project can be started (using F5). It is the default project of the solution.

As the site starts up, it will guide you through the initial installation.

Tools & Templates

There are several C# Visual Studio templates available to create new packages, modules and skins. These can optionally be installed using the YetaWF Tools & Templates installer.