After adding 2sxc templates to your Oqtane project, the build process may fail with numerous errors—sometimes over 1,000—rendering Oqtane unusable in the development environment. This happens because Visual Studio includes all new files and folders added by the templates into the project build by default.

The 2sxc templates introduce additional files that are necessary for the application to run but are not meant to be part of the compiled code. Including them causes conflicts and compilation errors because the compiler tries to process files that aren't valid C# code or are duplicates.

There are two ways you can fix it:

Option 1: Click your Way through Visual Studio

  1. In VS2022, in Solution Explorer, on Oqtane.Server project, Exclude From Project following folders (in right click context menu):
    1. 2sxc
  2. Run debug one more time to confirm that all is OK.

Option 2: Adjust your Oqtane.Server.csproj

  1. Open Oqtane.Server.csproj
    Locate the Oqtane.Server.csproj file in your project directory and open it with a text editor or within Visual Studio.
  2. Add Exclusion Rules
    Insert the following `<ItemGroup>` section into the project file:
       <ItemGroup>
       <!-- Exclude these directories from compilation -->
       <Compile Remove="2sxc\**" />
       <!-- Exclude content files from the build output -->
       <Content Remove="2sxc\**" />
       <!-- Exclude files from being embedded as resources -->
       <EmbeddedResource Remove="2sxc\**" />
       <!-- Exclude miscellaneous files not included elsewhere -->
       <None Remove="2sxc\**" />
       <!-- Exclude files from the dotnet watch tool -->
       <Watch Remove="2sxc\**" />
     </ItemGroup>
    This configuration explicitly tells the build system to ignore all files within the 2sxc directory when compiling, embedding resources, including content files, and monitoring for changes.
  3. Save and Rebuild
    Save the changes to Oqtane.Server.csproj and rebuild the project by pressing F5 or selecting Build > Rebuild Solution in Visual Studio.