Table of Contents

DotNet Project (VS Code Helper)

This is an extension for 2sxc Apps and can be installed into each App individually.

This extension provides tools and helpers for .NET projects in VS Code.

Demo IntelliSense in VS Code

Installation and Upgrades

Then

  1. copy the files app.sln and app.csproj from the templates folder to your main app folder (or a specific edition-subfolder)
  2. restart VS Code
  3. if VS Code / C# Dev Kit asks which solution to load, choose the correct app.sln for the folder you want to work on
Note

2sxc app setups contains multiple .sln files, so VS Code / C# Dev Kit should usually prompt you to choose one and remember that choice for the workspace. If it does not load the correct solution reliably, use the .NET: Open Solution command and manually open the root app.sln.

That's it - you should now have IntelliSense on all your C# and Razor files.

Tip

Anything that follows is just a deep-dive, you usually do not need to understand it.

For most users, you can stop reading here.

How it works

The extension uses the OmniSharp extension to provide IntelliSense and other C# features in VS Code. By including a .sln and .csproj file in the app folder, OmniSharp can recognize the project structure and provide the necessary tooling support.

Basically this is what happens:

  1. The app.sln file defines a solution that includes the app.csproj project.
  2. The app.csproj imports the /extensions/dotnet-project/all-in-one.import.csproj which contains everything needed for the project
  3. The all-in-one.import.csproj file imports the necessary SDKs and packages to enable C# development in the app folder.

These would be your files:

The app.sln file is a standard Visual Studio solution file that defines the structure of the project. It includes the app.csproj project and any other projects that may be needed in the future. This is what's probably in the file:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
#
# Visual Studio .sln File for 2sxc App
# This is necessary so that VS Code can perform intellisense in Razor
# It also requires a csproj file to exist as well
# 
# Read more and get help for issues on https://go.2sxc.org/vscode
#

VisualStudioVersion = 18.3.11520.95
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "app", "app.csproj", "{9F7A078F-99D5-4EF4-8EC0-C6B920FE679C}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{9F7A078F-99D5-4EF4-8EC0-C6B920FE679C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9F7A078F-99D5-4EF4-8EC0-C6B920FE679C}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9F7A078F-99D5-4EF4-8EC0-C6B920FE679C}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9F7A078F-99D5-4EF4-8EC0-C6B920FE679C}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

There's not much to add here, just leave it as is and it will work.

Internal Complexity

Internally it's a bit more complex, because it has to work with all kinds of different scenarios such as:

  1. It could be running in DNN or Oqtane.
  2. It needs to work with both .NET Framework (net48) and .NET Core (net10) projects.
  3. It's always in an App, but some Apps have it in their root folder, while others have it in an edition-subfolder.
  4. In Oqtane, the path will vary if you're running a production or development version of Oqtane.
  5. When using editions and opening VS Code on the root folder, it may have identical files in each edition, confusing the analyzers, so we have to remove editions such as live or bs4 from the project when running in design-time in DNN.
  6. In DNN we had to do some trickery to make older Razor code work with the newer .net Core Razor Code Analyzers.

This is the inner logic which is implemented in the all-in-one.import.csproj file, which imports the necessary SDKs and packages based on the environment and project type.

Customizing the Configuration

When you need to do some customizations, you can always

  1. Pre-set some of the variables such as CmsType in your app.csproj before the import.
  2. Customize your own app.csproj file to import specific files instead of the all-in-one.import.csproj.

Understanding csproj files

In case you're not familiar with .csproj files, here's a quick overview:

  • PropertyGroup is used to define variables which are used later in the file
  • ItemGroup is used to define lists of items, like files, references, etc.

Both of these can have conditions, so you can define different settings for different situations.

History

  1. v01.00 - Initial release for 2sxc v21 2026-03-21

Shortlink: https://go.2sxc.org/ext-csproj