Introduction

SnapDevelop is a lightweight yet powerful C# IDE for rapidly developing web or cloud applications on top of the cross-OS .NET Core framework. This User Guide explains the wide variety of features of SnapDevelop IDE that make it easy for you to edit, test, debug, compile, build, and publish your applications.

Personalizing the SnapDevelop IDE

You can personalize your SnapDevelop IDE by selecting the Options tab from the Tools menu. The Options allows you to specify settings in relation to the development environment, DataWindow converter, scaffolding, projects and solutions, source control, text editor, NuGet package manager, PowerScript migrator, as well as Web API tester.

Environment settings

In Environment, you can set the color theme for the user interface in the IDE, and configure a few options on how the IDE manages documents (files).

General color theme setting

You can choose one of the two color themes: Light and Dark. The default color theme is Light. If you change the theme to Dark, the color theme for the whole IDE changes to Dark.

Documents

The Documents settings provide a few options on how the IDE manages documents (files).

  • Detect when file is changed outside the environment and Reload modified files unless there are unsaved changes

    If you enable the Detect when file is changed outside the environment option, SnapDevelop will automatically track whether a currently-open file is changed in an external editor.

    If you enable the Reload modified files unless there are unsaved changes option, when SnapDevelop finds that a currently-open file is changed in an external editor, SnapDevelop will automatically load the latest version of the file. If you disable this option, SnapDevelop will prompt a message to ask you whether to load the new version of the file or not:

  • Reload modified files unless there are unsaved changes

    If you have selected Detect when file is changed outside the environment and an open file in the IDE is changed outside the IDE, a warning message automatically pops up. If you select the current option, no warning message pops up and the file is reloaded into the IDE to adopt the changes made externally.

  • Open file using directory of currently active document

    If you enable this option, the Open File dialog box displays the directory of the active document. Otherwise, it displays the directory that you most recently used to open a file.

  • Show Miscellaneous files in Solution Explorer and Items saved in the Miscellaneous files project

    If you enable the Show Miscellaneous files in Solution Explorer option, the Miscellaneous Files node appears in Solution Explorer.

    The Items saved in the Miscellaneous files project option sets the number of files that will appear in the Miscellaneous Files folder in Solution Explorer. You can specify a number between 0 and 256 (inclusive).

DataWindow Converter settings

In DataWindow Converter | General, you can set a few global options that apply throughout the C# model generation process.

User interface options

  • Auto-select listed child DataWindows if their parent DataWindow gets selected

    With this option enabled, when you have a DataWindow to convert to C# models and the DataWindow has child DataWindow(s), the child DataWindows are automatically selected for the conversion as well.

  • Single expand DataWindow nodes

    With this option enabled, when you click a DataWindow to view its column settings, only the nodes in the DataWindow gets expanded, and all the nodes in the other DataWindows are in folded status.

    For example, the following screenshot shows that the nodes in the DataWindow d_customer_list are expanded, and the nodes in the d_customer_select and d_dddw_prod_category DataWindows are all folded.

Parse settings

  • Use a column name placeholder @(_COLUMN_PLACEHOLDER_) to replace all column names in DwSelect

    Using the placeholder will make it easier to add columns later in the model.

    For example, the DwSelect attribute may look like below when using the column placeholder:

    [DwSelect("PBSELECT( VERSION(400) TABLE(NAME=\"examples\" ) @(_COLUMNS_PLACEHOLDER_) WHERE(    EXP1 =\"( examples.window\"   OP =\"=\"    EXP2 =\":win )\" ) ) ARG(NAME = \"app\" TYPE = string)  ARG(NAME = \"win\" TYPE = string)")]
    

    The DwSelect attribute may look like below when using the actual column name:

    [DwSelect("PBSELECT( VERSION(400) TABLE(NAME=\"examples\" ) COLUMN(NAME=\"examples.description\") COLUMN(NAME=\"examples.window\") COLUMN(NAME=\"examples.version\") COLUMN(NAME=\"examples.technique\") COLUMN(NAME=\"examples.new\") COLUMN(NAME=\"examples.enhanced\") COLUMN(NAME=\"examples.title\")WHERE(    EXP1 =\"( examples.window\"   OP =\"=\"    EXP2 =\":win )\" ) ) ARG(NAME = \"app\" TYPE = string)  ARG(NAME = \"win\" TYPE = string)")]
    

    Note: It is recommended that this option should be selected, because coding complexity can be simplified. However, if a DataWindow uses stored procedure as its data source, the option won't take effect.

Model name settings

  • Add prefix and/or suffix to the name of the generated model classes

    For example, if you add {pbt_} as prefix and {_pbl} as suffix, the model class generated from DataWindow named "A" will be "Pbt_A_pbl".

Scaffolding settings

In Scaffolding, you can specify the global options to apply during the scaffolding process and for the generated services/controllers.

Scaffolding general setting

Under Scaffolding | General, you can specify the namespace style to use for classes in the generated services/controller(s). Two namespace styles are available:

  • Root namespace only

    If you select this option, the generated services/controllers use the root namespace you specify in the Namespace setting for the target service(s)/controller(s).

    For example, if you configure the following settings for the target service(s)/controller(s):

    The namespace declaration in the generated service/controller will be similar to the following:

    namespace WebApplicationTest
    
  • Full namespace

    If you select this option, the namespace in the generated services/controllers will contain both the root namespace and the namespace path, which means that with the above example, the namespace declaration in the generated service will be similar to the following:

    namespace WebApplicationTest.Services
    

    And the namespace declaration in the generated controller will be similar to the following:

    namespace WebApplicationTest.Controllers
    

Parsing rules

Under Scaffolding | Parsing Rules, you can specify how the scaffolding function would parse and get the classes from the source items. Note that you can only define parsing rules for user-defined scaffolding templates.

  • When Scaffolding Based on a User-Defined Template

    At the first step, you need to select a user-defined scaffolding template first. The configured parsing rule will only work for the currently selected template. You can specify different parsing rules for different templates.

  • Specify Classes and Class Attributes to be Parsed

    Get classes by keyword means that the scaffolding function will identify classes from the source items by the keyword Interface, or Class, or both.

    Class(es)/Class attribute(s) means that the scaffolding function will identify classes from the source items by the class name or class attributes.

    • If you want to parse all classes and/or class attributes in your program, you can select the Class(es) check box and then the Class attribute(s) check box, and leave the input box empty.
    • If you want to parse some of the classes and/or class attributes in your program, you can select the Class check box and then the Class attribute(s) check box, and specify the class(es)/class attribute(s) in the input box.
    • If you select neither the Class(es) nor the Class attribute(s) check box, no class or class attribute will be parsed.

Projects and solutions settings

Under Projects and Solutions | General, you can configure a basic setting about the file-moving behavior in Solution Explorer.

  • Prompt before moving files to a new location

    If you enable this option, a confirmation message box pops up when you attempt to move a file in Solution Explorer.

Source control settings

Under Source Control | Plug-in Selection, you can specify the default source control plug-in to use within the IDE.

  • Plug-in Selection

    Two source control plug-ins, SnapDevelop Git and SnapDevelop SVN, are provided when you install SnapDevelop. You can add a solution to Git source control which uses SnapDevelop Git plug-in, or to Subversion source control which uses SnapDevelop SVN plug-in.

    Although you cannot add a solution to two different source control systems directly in SnapDevelop IDE, you may do it using a third-party source control client. If your solution is in the repositories of two different source control systems at the same time, you can decide which source control system to use for the solution in the SnapDevelop IDE using the Plug-in Selection option.

Text editor settings

In Text Editor, you can change global settings for the SnapDevelop code editor and customize the behaviors of the code editor.

General settings

Under Text Editor | General, you can specify the various settings for the text editor and determine how the editor displays the code in it.

Settings
  • Drag and drop text editing

    If you enable this option, you are able to move code to anywhere in the current file by selecting it and dragging it with the mouse.

  • Show end of line

    If you enable this option, you will be able to see the end-of-line markers in text editor, so that you can differentiate CR LF and LF line endings.

  • Track changes

    If you enable this option, a vertical yellow line appears in the left margin of the changed text to indicate that the text has changed since the file was last saved.

  • Enable single-click URL navigation

    If you enable this option, the mouse cursor changes to a pointing hand when it passes over a URL in the editor and Ctrl is pressed. You can then click the URL to go to the indicated page in your web browser.

  • Hide cursor while typing

    This option offers you the ability to make the cursor invisible on screen while you are typing, until you stop typing and move your mouse.

Display
  • Show space character

    If you enable this option, the text editor shows the space characters, making a program more readable.

  • Highlight current line

    If you enable this option, a grey box appears around the line of code where the cursor is located.

  • Line numbers

    If you enable this option, a line number appears next to each line of code.

  • Column rulers

    The column ruler serves to determine line lengths. It is particularly useful when your editor has line length restrictions. The column ruler defaults to the 120th character and can be adjusted according to your needs.

C# general settings

Under Text Editor | C# | General, you can manage the ways the code editor behaves when you are writing C# code.

Statement completion
  • Synchronization delay time of syntax service

    Synchronization delay time of syntax service refers to:

    • how long the quick info stays visible when your mouse hovers over a particular variable and then leaves the variable;

    • how soon the code color changes when you write or insert code in the editor;

    • how soon the code folding updates when you insert blocks of code into the editor;

    • how soon the header dropdown list updates when you add blocks of code into the editor.

    The synchronization delay time defaults to 150 ms. If necessary, you can adjust it within the range from 50 ms to 1,000 ms.

  • Auto filter the list of members on typing

    If you enable this option, as you write code in the code editor, the editor will pop up lists of available values, members, properties, or methods, for you to select and insert into your code.

Settings
  • Enable virtual space

    If you enable this option, a long line of code will not wrap to the next line no matter how long it is.

  • Word wrap

    If you enable this option, the part of a long line of code that extends horizontally beyond the view of the code editor will automatically wrap to the next line.

  • Inherit word wrap indentation

    This option determines whether to indent the next lines in case of word wrapping. The indentation value represents the number of characters to indent and can be positive or negative, indicating whether to increase or decrease the indentation on the basis of the indentation of the previous line.

NuGet package manager settings

In NuGet Package Manager, you specify how the NuGet Package Manager downloads and manages NuGet packages.

General settings

Under NuGet Package Manager | General, you can configure the general NuGet package management settings.

Package restore
  • Allow NuGet to download missing packages

    If you enable this option, SnapDevelop would first try to retrieve, from the cache, the NuGet packages referenced in a project. If the packages are not available in the cache, NuGet then attempts to download the packages from all enabled sources. If you enable this option, missing packages are automatically restored when you build a project in SnapDevelop.

  • Automatically check for missing packages during build in SnapDevelop

    This option controls whether SnapDevelop automatically checks for missing packages when you build a project in SnapDevelop.

Package management
  • Default package management format

    SnapDevelop provides two package management formats - Packages.config and PackageReference. The Package.config file is displayed in Solution Explorer while the PackageReference file is included in the .csproj file in File Explorer.

    .NET Core and .NET Standard projects that SnapDevelop currently supports are by default managed via the PackageReference format. The .NET Framework projects that SnapDevelop can open but does not support right now are by default managed via the Package.config format.

  • Clear all NuGet cache(s)

    You can choose to clear all NuGet caches on your computer so as to prevent yourself from using the old or obsolete packages and help your apps run better on your machine.

Package sources

This option allows you to teach NuGet Package Manager where to find packages to download. You can have multiple package sources.

  • Available package sources

    The available package sources are custom package sources. In SnapDevelop, you can add multiple package sources to this list for NuGet Package Manager.

    1. To add a source, select the plus icon at the upper right side of the manager, specify the name and the URL of the package source, and select Update. The added source will appear in the list of Available package sources.

    2. To change a package source, select the desired package source, reedit its name and URL, and select Update.

    3. To disable a package source, clear the box to the left of the package name in the list.

    4. To remove a package source, select it and then select the trash icon.

    The up and down arrows do not change the order of the package sources. SnapDevelop uses the package that is first to respond to requests, regardless of the order of the package sources.

  • Machine-wide package sources

    The machine-wide package sources list all the package sources that are configured in the \Program Files (x86)\NuGet\Config folder and are not yet listed as an available package sources.

PowerScript Migrator

In PowerScript Migrator, you can configure how you would like to translate the array, any type, event, and other translation settings when you use the PowerScript Migrator plug-in to translate PowerScript to C#.

Translate the array to

  • C# array type -- (default) Fixed-length arrays will be translated to C# array, and variable-length arrays will be translated to PbArray. PbArray is a custom array type defined in PowerScript.Bridge.
  • PbArray -- All arrays will be translated to PbArray. Fixed-length arrays will use ArrayEx.CreateInstance method to process the default value for nullable types. The C# array will be initialized in the .NET way, for example, two-dimensional arrays are assigned with values horizontally, missing data will be populated automatically, redundant data will be discarded. Value assignments between arrays will use the ArrayEx.Assign method.

Translate Any type to

  • C# object type -- The Any data type will be translated to C# object type.
  • C# dynamic -- The Any data type will be translated to C# dynamic. If you translate Any data type to C# dynamic, no compiler diagnostic would be provided for the related code.

Translate the event to

  • A method -- (default) the events will be translated to C# methods.
  • A C# event that uses EventArgs for its parameter or return value -- all events will be translated to C# events. The event that has no parameter and return value is always translated to the C# event (similar to this: void xxxHandler(object sender, EventArgs args)). If the event has parameter or return value, the C# event will use EventArgs for the parameter and return value.

Other translation settings

  • Whether to translate the basic type to be nullable.
  • Whether to add informative comments to the translated code. The comments will be tagged with INFO.
  • Whether to add comments to the code that may be inaccurately translated. The comments will be tagged with WARN.
  • Whether to add comments to the code that may be erroneously translated. The comments will be tagged with ERROR.
  • Whether to output SqlCode of the SELECT statement in SqlResult parameter when a query is run.

Web API Tester

General Web API Tester settings

Under Web API Tester | General, you can configure how the built-in Web API Tester will behave when performing web API tests.

  • Allow redirection of requests

    If you enable the option, and the web site that the Web API Tester sends requests to has configured redirection, the Web API Tester will still make the test request to the redirected URL.

  • Request timeout

    You can configure the time interval between sending a web API test request and the request gets a timeout. Because a request usually takes longer time to complete in debug mode, you shall set the interval to a much longer period in debug mode than in normal mode.

  • Maximum response size

    The setting is self-explanatory. If the response returned from a request exceeds certain size, the Web API Tester can either trigger a download prompt that asks you to download the response to a text file, or just throws an exception.

  • Store server cookies and use them when sending requests

    This option means that the Web API Tester will actively store server cookies and use the cookies for the subsequent requests.

Proxy settings

Under Web API Tester | Proxy, you can configure how the Web API Tester will connect to the target server.

  • Configure global proxy settings

    You can configure the global proxy settings to use by the Web API Tester when it sends requests to the server.

  • Use system proxy

    If you want the Web API Tester to use the default proxy settings on your local machine, enable this option.

Developing with SnapDevelop

This section describes how to use the code editor and other tools in SnapDevelop to write, manage, and improve your code.

Moving around in the IDE

The SnapDevelop IDE allows you to move from file to file and window to window using keyboard shortcuts so that you can significantly increase productivity when you are developing in this IDE.

You can use the following methods to navigate through open files or tool windows in the code editor:

  • Press Ctrl+- to activate open files in the code editor in the order they were most recently accessed.

  • Press Ctrl+Tab to navigate through active tool windows and active files in spite of the order they were accessed. Just hold down the Ctrl key and press Tab repeatedly until you select the intended file.

  • Click the Active Files button in the upper right corner of the editor, and then select the intended file from the list.

Working with solutions and projects

Introducing basic concepts

Project

A project contains all the source code files, data files, etc. that are compiled into a library or executable, and also includes compiler settings and other configuration files that might be used by a variety of services or components that your program works with.

Project File

Each C# project contains a project file identifiable from the file extension (.csproj). The project file is an XML file that contains all the information needed to build a project.

Solution

A solution is a container for projects that are related in some way. It contains build information, SnapDevelop window settings, and any miscellaneous files that are not directly related to a particular project. A solution is defined by a text file with the .sln extension that integrates projects, project items and solution items in the solution.

Solution Explorer

After you create a new project, you can use Solution Explorer to view and manage the project and solution and their related items.

A variety of menu commands, such as building/rebuilding a project, managing/restoring NuGet packages, adding a reference, and renaming a file, are offered by right-clicking on various items in Solution Explorer.

The toolbar at the top of Solution Explorer currently provides four options:

  • Sync with Active Document, which allows you to locate the current file in the code editor inside Solution Explorer.
  • Collapse All, which collapses all nodes in Solution Explorer.
  • Show All Files, which shows all hidden files in the selected project.
  • Properties, which allows you to set the various properties of the project/solution.

Creating solutions and projects

Creating a new project

To create a new project, take the following steps:

  1. Select New > Project from the File menu.

  2. The New Project page will pop up.

  3. On the New Project page, select a project template from the available project templates options.

  4. Specify a name for the project, select where you want the project to be created, and specify the solution name.

    Note that if you select the ASP.NET Core Web API template, there are Sample Code options, which are Basic, .NET DataStore, and SqlModelMapper. The Basic option contains no data access code while the other two options contain their corresponding data access code. For more information about the sample code files, please refer to the Readme text that appears by default when you create a project with .NET DataStore, or SqlModelMapper sample code.

  5. Click OK to generate the project. The project is then opened by SnapDevelop so that you can start developing.

Setting a startup project

You can view your solutions and projects in the Solution Explorer tool window, in which you will see that a project is marked in bold. Such a project is called the startup project, which refers to the project that launches when you run the application.

The startup project can be changed to another by right-clicking on the node of the intended project and then selecting Set as Startup Project.

Adding files to a solution

As described earlier, a project contains all items required to build an application in SnapDevelop. When you create a new project, SnapDevelop creates a solution to accommodate the project. When the solution is created, you can also add existing and/or new projects/items to the solution. The newly added items do not necessarily belong to any individual project.

Sometimes, multiple projects in your solution share a file, such as the readme file for the solution, and some files belong at the solution level instead of the project level. In such cases, you can add the files to the solution itself. To do so, right-click on the solution node in Solution Explorer and then select Add > New Item, or Add > Existing Item.

Creating an empty solution

You can also create an empty solution if you want to construct your solution and projects from scratch.

To create an empty solution:

  1. On the menu bar, select File > New > Project.

  2. In the left pane of the New Project dialog box, select Other Project > Solutions.

  3. In the middle pane, select Blank Solution.

  4. Configure your solution, and then click OK.

After the empty solution is created, you can add new/existing projects or items to it by selecting Add > New/Existing Project or Add > New/Existing Item from the right-click context menu.

Deleting a solution, project or item

You can use the SnapDevelop IDE or File Explorer to delete a solution, project or item. The difference is that deleting items within the SnapDevelop IDE only removes them from the current project or solution while deleting items in File Explorer removes them permanently. Before you delete items in File Explorer, however, it is recommended that you back the items up in case you need to use them later.

To delete an item within the SnapDevelop IDE, select the item and then select Delete from the right-click context menu.

To permanently remove an item,

  1. Right-click on the node of the solution/project/item you want to delete in Solution Explorer and then select Open Folder in File Explorer.
  2. Navigate up one level in File Explorer.
  3. Select the folder that contains the solution and then press the Delete key.

Managing solution and project properties

Project properties allow you to specify the various aspects of building, packaging, debugging, and signing. To access project properties, right-click on the project node in Solution Explorer and then select Properties. For details about the configuration of project properties, refer to Configuring Project Properties.

To access solution properties, right-click on the solution node in Solution Explorer and then select Properties. In the Solution Properties configuration page, you can specify the startup project when you run the application, and set various project configurations for Debug or Release builds. For details about the configuration of solution properties, refer to Configuring Solution Properties.

Managing project references

Three available referencing methods

SnapDevelop currently supports three referencing methods, which are:

  • Project-to-project Reference
  • Shared Project Reference
  • File Reference
Adding or removing references using the reference manager

To add a reference, right-click on the project node and then select Add > Reference, or right-click on the Dependencies node in Solution Explorer and then select Add Reference.

The Reference Manager dialog box appears and lists the available references by group.

In the Reference Manager dialog box, there are four tabs:

  • Projects, which lists all compatible projects within the current solution.
  • Shared Projects, which allows you to write common code that can be referenced by various application projects.
  • Browse, which allows you to browse for a component in the file system.
  • Recent, which lists the components newly added to projects.

Note that there is a search bar in the Reference Manager dialog box that can be used to filter items under the tab that is in focus.

If your application cannot find a referenced component, an exception will be thrown. There are several scenarios in which an exception will be thrown.

  • Network failure;
  • The file being referenced has been deleted;
  • The file being referenced has been renamed.

If any such exception occurs, you need to handle it in order to use the references properly.

Network failure

Fix the network connection problems until you have access to the required resources.

The file being referenced has been deleted

Delete the reference, or read it from another location if the reference exists elsewhere on your computer.

The file being referenced has been renamed

Delete the reference, and then add a reference to the renamed file.

Managing application resources

Specifying an application icon

You can use the default application icon or customize your application icon. To customize your icon,

  1. Select the project node in Solution Explorer.
  2. Select Properties from the right-click context menu.
  3. Select the Application tab in the Project Designer that appears.
  4. In the Icon list, click Browse to browse to the location of the intended icon file.
Embedding a manifest

To embed a manifest,

  1. Right-click on the project node in Solution Explorer.
  2. Select Properties from the context menu.
  3. Select the Application tab in the Project Designer that appears.
  4. In the Embed list, select Embed manifest with default settings.
Specifying a resource file

To specify a resource file,

  1. Right-click on the project node in Solution Explorer.
  2. Select Properties from the context menu.
  3. Select the Application tab in the Project Designer that appears.
  4. Select the Resource file radio button, and then click Browse to browse to the location of the intended resource file.

Application settings

Managing application settings

Application settings allow you to save various application-related information, such as application URL, launch URL, and database connection strings.

The project system automatically stores application settings into two JSON files (launchSettings.json and appsettings.json) when you create a Web application in SnapDevelop.

launchSettings.json

In the file:

  • applicationURL: The URL where you can launch any application on your local computer from the browser.
  • launchBrowser: Whether to launch the browser when you run your application.
  • launchURL: The URL to launch on your local computer.
  • environmentVariables: Variables that ASP.NET Core reads at app startup and that ASP.NET Core uses to configure app behaviors.

appsettings.json

In the file:

  • LogLevel: Indicates the minimum level to log for selected categories.
  • AllowedHosts: The hosts headers that are allowed to access this site.
  • ConnectionStrings: Strings that specify information about a data source and the way of accessing to it.

Note: There are two configuration files that manage the Web app at run time. The default application configuration is stored in the appsettings.json file. However, you can use the appsettings.Development.json file to override these settings.

Adding an application configuration file to your project

You can customize the way the common language runtime locates and loads assembly files by adding an application configuration file to your project.

When you build your project, SnapDevelop automatically copies your application configuration file, changes the file name of the copy to match your executable, and then moves the copy to the bin directory.

To add an application configuration file to your project,

  1. Right-click on the project node in Solution Explorer and then select Add > New Item.

  2. In the New Item dialog box that appears, expand C# and then select the Web Configuration File template.

  3. Enter a name for the configuration file in the Name text box, and then click OK.

    A file named web.config is then added to your project.

Managing assembly and manifest signing

Asset types that can be signed

You can sign the following .NET assemblies and application manifests:

  • Executables (.exe)
  • Application manifests (.exe.manifest)
  • Deployment manifests (.application)
  • Shared component assemblies (.dll)
Signing an assembly in SnapDevelop

To sign an assembly,

  1. Right-click on the project node in Solution Explorer.
  2. Select Properties from the context menu.
  3. Select the Signing tab and then select the Sign the assembly check box.
  4. Specify a key file.

Refer to Signing for details about how to sign an assembly.

Targeting a framework

SnapDevelop allows you to specify the .NET Core version that you want your project to target. If a .NET Core application is to run on another computer, it is necessary that the .NET Core version that the application targets should be compatible with the .NET Core version installed on the computer.

A SnapDevelop solution can contain projects that target different .NET Core versions.

Changing the target framework

When you create a .NET Core project, SnapDevelop doesn't provide the option for you to select the target .NET Core version after you select a project template. The latest .NET Core version is selected by default. However, you can change the target .NET Core version if you want to.

To change the target framework:

  1. Select the project you want to change in Solution Explorer, and then select Properties from the right-click context menu.
  2. In the Properties window, select the Application tab.
  3. In the Target framework list, select the intended version.

Managing project and item templates

Introducing project and item templates

A variety of predefined project and item templates are automatically installed when you install SnapDevelop. These templates provide a basic set of pre-generated code and structure based on which developers just need to add some other code and resources to the project/item, thus reducing a lot of repetitive work during development.

SnapDevelop currently provides the following project templates:

  • ASP.NET Core Web API
  • Console App (.NET Core)
  • Class Library (.NET Core)
  • Class Library (.NET Standard)
  • Shared Project
  • xUnit Test (.NET Core)

and the following item templates:

  • Class
  • Interface
  • Enum
  • DataContext
  • API Controller Class
  • Service (.NET DataStore)
  • Service (SqlModelMapper)
  • JSON File
  • Text File
  • XML File
  • Web Configuration File

These templates are available to choose from when you create a new project/item. All project or item templates, be they default templates or custom ones, share the following items:

  • The files to be created when the template is used. These files include source code files, embedded resources, project files, etc.
  • A .template file, which contains the metadata needed to create a project or item from the template and to display the template in the New Project and New Item dialog boxes.

When these files are compressed into a .zip file and put in the correct folder:

  • Project templates appear in the New Project dialog box.

  • Item templates appear in the New Item dialog box.

Locating project and item templates

In order for the templates to be displayed in the New Project and New Item dialog boxes, the template files must be placed in a known location.

By default, project templates are stored in:

  • Program Files (x86)\Appeon\SnapDevelop 2019 R2\Tools\Common7\IDE\ProjectTemplates\CSharp

And item projects are stored in:

  • Program Files (x86)\Appeon\SnapDevelop 2019 R2\Tools\Common7\IDE\ItemTemplates\CSharp
Editing project and item templates

It is recommended that you do not change the configuration and design of system templates. If you insist to modify a template, navigate to the storage location of the specific template and modify it. After you have properly modified the template, you should save the modification so that it becomes effective in the New Project and New Item dialog boxes.

Creating a Web API

An independent tutorial on how to create a Web API in SnapDevelop is available on the following link: https://www.appeon.com/support/documents/appeon_online_help/snapdevelop2019r2/Create_a_Web_API/index.html.

Testing a Web API

An independent tutorial on how to test a Web API in SnapDevelop is available on the following link: https://docs.appeon.com/appeon_online_help/snapdevelop2019r2/Testing_with_Web_API_Tester/index.html.

Working with the code editor

The SnapDevelop editor offers a considerable number of features that make it easy for you to write and manage your code. For example, you can find and replace text in single or multiple files, in current project, or in the entire solution. You can collapse and expand the various blocks of code by using the Outlining feature. You can find code by using such features as Go To Definition, and Find All References.

Using the code editor

Basic features

This section describes the basic features of the SnapDevelop code editor, which can help you edit your code quite efficiently and easily.

Error and warning marking

When you write code, you may see wavy underlines of different colors or light bulbs in your code. Red wavy underlines indicate syntax errors and green underlines indicate warnings. If your mouse hovers over an error, potential fixes for the error are suggested right below.

Brace matching

When the insertion point is placed on an open brace in a file, both the open brace and the closing brace are highlighted. This feature allows you to immediately see which braces are misplaced or missing.

Code auto completion

Code Auto Completion offers all possible options alphabetically as you type the trigger characters in the code editor, and highlights the option that best matches the trigger characters.

Line numbering

Line numbers are not displayed by default. If you enable the Line numbers option in the Tools > Options > Text Editor > General settings, line numbers are displayed in the left margin of the code editor.

Change tracking

If you enable the Track changes option in the Tools > Options > Text Editor > General settings, changes you have made since the file was opened but not saved are indicated by yellow vertical lines in the left margin of the code editor.

Code and text selecting

You can select code either in box mode or in the standard continuous stream mode. To select code in box mode, press Alt as you drag the mouse over the selection (or press Alt+Shift+<arrow key>). The selection includes all characters within the rectangle defined by the first character and the last character in the selection. Anything typed or pasted into the selected area is inserted at the same point on each line.

Virtual space

If you enable virtual space in the Tools > Options > Text Editor > C# dialog box, a long line of code that is displayed on more than one line will be displayed on one line only. Note that you can enable either Word Wrap or Virtual Space, but not both at the same time.

Word wrapping

You can select or clear the Word Wrap option in the Tools > Options > Text Editor > C# dialog box. If you select the option, part of a long line extending beyond the current width of the editor window is displayed on the next line.

Undo and redo

You can run the undo or redo command to actions in the current SnapDevelop session by selecting Edit > Undo or Edit > Redo.

Advanced features

A variety of advanced editing features are available on the Edit > Advanced menu on the toolbar.

Format document

Sets the proper indentation of lines of code and moves curly braces to separate lines in the document.

Format selection

Sets the proper indentation of lines of code and moves curly braces to separate lines in the selection.

Make uppercase

Changes all selected characters to uppercase.

Make lowercase

Changes all selected characters to lowercase.

Comment selection

Adds comment characters to the selected line(s), or to the current line if no characters are selected.

Uncomment selection

Removes comment characters from the selected line(s), or from the current line.

Increase line indent

Adds spaces to the selected lines or the current line.

Decrease line indent

Removes spaces from the selected lines or the current line.

Outlining

You can use the Outlining feature to display the outline of your code the way you want. To use this feature, select Edit > Outlining. We use the following text code as an example to demonstrate how you can perform the various outlining operations.

The Outlining feature allows you to:

  • Toggle Outlining Expansion, which reverses the current collapsed or expanded state of the innermost outlining section when you put the cursor in a nested collapsed section.

  • Toggle All Outlining, which sets all blocks of code to the same state, expanded or collapsed.

  • Stop Outlining, which removes all outlining information throughout the file.

  • Stop Hiding Current, which removes the outlining information for the currently selected blocks of code. If the cursor lies in a nested collapsed section, you can use this feature to expand the nested collapsed section.

  • Collapse to Definitions, which collapses the members of all types.

  • Start Automatic Outlining, which automatically sets all blocks of code to the expanded state. Note that this feature can be used only after you have selected the Stop Outlining feature.

Finding and replacing

Finding and replacing text

The SnapDevelop editor allows you to find and replace text by using Find and Replace (Ctrl+F or Ctrl+H). If you select a string in the current file and then press Ctrl+F or Ctrl+H, the Find and Replace control displays in the upper right corner of the code editor, with every matching string in the current file highlighted. You can navigate from one matching string to another by clicking the Find Next button or the Find Previous button on the search control.

On this search control, you can access replacement options by clicking the button immediately before the Find search box. If you want to replace the matching strings one by one, click the Replace Next button immediately following the Replace text box. If you want to replace all matching strings, click the Replace All button instead.

Please note that there are several other buttons such as Match Case, Match Whole Word, and Use Regular Expressions, which can help you find and replace more accurately, and there is a dropdown list, which allows you to specify the scope of the Find and Replace actions. If you want to know how to use regular expressions, please refer to Appendix C: Regular Expression Examples.

Find in files and replace in files

Find/Replace in Files works much like the Find and Replace control. To access the Find/Replace in Files dialog box, press Ctrl+Shift+F, or select Find and Replace on the Edit menu.

When you select Find All, the Find Results window opens and lists all matches for your search. If you select a result in the list, the related file displays even if the file is not already active for editing and the match in the file is highlighted.

Finding in files

If you want to display Find in Files, select Find and Replace on the Edit menu and then select Find in Files. You can also display Find in Files by using the keyboard shortcut (Ctrl+Shift+F).

Find what

If you want to search for a particular string, specify it in the text box. Note that the Find what dropdown list stores 20 searches you've made most recently. If you want to search for any of the stored strings, open the dropdown list and then select the desired string.

Look in

The Look in dropdown list has several options, including Current Document, Current Project, Entire Solution and All Open Documents, which determine the scope for your searches.

Find options

Find options can be expanded or collapsed. The following options can be enabled or disabled:

  • Match case: If enabled, a Find Results search will be case-sensitive.

  • Match whole word: If enabled, the Find Results windows will only return whole word matches.

Replacing in files

If you want to display Replace in Files, select Find and Replace on the Edit menu and then select Replace in Files. You can also display Replace in Files by using the keyboard shortcut (Ctrl+Shift+H). Replace in Files works virtually the same way as Find in Files, except for the fact that Replace in Files additionally provides the Replace with option.

Replace with

To replace the string in the Find what field with a desired string, enter the replacement string in the Replace with filed. If you want to delete the occurrence(s) of the string specified in the Find what field, leave this field blank. The Replace with dropdown list stores the 20 searches you've made most recently. You can open the list to select a particular string if necessary.

Generating and refactoring code

Performing quick actions

Quick Actions allow you to easily generate and refactor code with a single action, and Quick Actions can be performed using the light bulb or screwdriver icons that appear when you put your cursor on a line of code for which an action is available.

Icons

The icon that displays when a quick action is available indicates the type of fix or refactoring. The light bulb icon indicates that you should perform an available action to improve your code. The screwdriver icon indicates that you can perform an available action to change the code, but you shouldn't necessarily perform the action.

Using light bulb or screwdriver icons to perform quick actions

In the following situations, the light bulb or screwdriver icons appear:

  • You hover your mouse over an error and there is a fix for the error;

  • You select the applicable line of code and select then Quick Actions and Refactorings from the right-click context menu.

To show potential fixes, select either the Show potential fixes link or the down arrow next to the light bulb. Then, you will see a list of possible Quick Actions.

Removing unnecessary using(s)

The Remove Unnecessary Using(s) command removes all unused using directives in the current file. When you select this command from the right-click context menu, unused namespace imports are removed.

Refactoring code

This feature allows you to reconstruct your existing code without changing its external behavior. It offers the following three options:

Rename

Allows you to rename identifiers for code symbols, such as namespaces, local variables, types, methods and properties. You can use this feature when you want to safely rename something without having to find all instances, and copy/paste the new name.

To use this feature, place your insertion point at an identifier and then select Refactor > Rename on the Edit menu (or right-click and then select Rename).

Extract method

Allows you to turn a block of code into its own method. You can use this feature when you have a fragment of existing code in some method that needs to be called from another method.

To use this feature,

  1. Select the code to be extracted.

  2. Select Refactor > Extract Method on the Edit menu.

Extract interface

Allows you to create an interface using existing members from an interface, struct, or class. You can use this feature when you have members in a class, struct, or interface that could be inherited by other classes, structs, or interfaces.

To use this feature,

  1. Put your cursor in the class name.

  2. Select Refactor > Extract Interface on the Edit menu.

  3. Enter the necessary information in the popup Extract Interface dialog box.

  4. Select OK.

Injecting service/DataContext

Injecting services

You can only inject services in the ConfigureServices method in the Startup.cs file of your project.

To inject service into the service container:

  1. Right-click at an empty line in the ConfigureServices method and then select Inject Service.

  2. In the Inject Service(s) configuration page that appears, specify the project and folder that accommodates the services and then select the services to inject.

  3. Specify the project and folder where the services reside.

    • Project

      Specifies the project that accommodates the services you may want to inject.

    • Folder

      Specifies the folder that accommodates the services you may want to inject. The backslash indicates that all folders are selected.

  4. Select the services to inject.

    Uses *Service to filter out all services in the selected folder in the target project. You can select the service to inject from all available services by selecting the corresponding checkbox.

  5. Select the injection mode:

    • Scoped

      Scoped lifetime services (AddScoped) are created once each time they are requested.

    • Singleton

      Singleton lifetime services (AddSingleton) are created the first time they are requested, or when Startup.ConfigureServices is run and an instance is specified with the service registration. All following requests use the same instance. If the application requires singleton behavior, it is recommended that you allow the service container to manage the service’s lifetime and that you should not implement the singleton design pattern and provide user code to manage the object's lifetime in the class.

    • Transient

      Transient lifetime services (AddTransient) are created each time they are requested from the service container. This lifetime works best for lightweight and stateless services.

Injecting DataContext

DataContext sets up the connection that your project uses to connect to the database. You can inject the DataContext into the service container of the project:

  1. Right-click at an empty line in the ConfigureServices method and then select Inject DataContext.

  2. In the Inject DataContext(s) configuration page that appears, specify the project and folder that accommodates the DataContexts and then select the DataContexts to inject.

  3. Specify the project and folder where the DataContext resides.

    • Project

      Specifies the project that accommodates the DataContexts you may want to inject.

    • Folder

      Specifies the folder that accommodates the DataContexts you may want to inject. The backslash indicates that all folders are selected.

  4. Select the DataContext to inject.

    Uses *DataContext* to filter out all DataContexts in the selected folder in the target project.

    • Connection Key

      Refers to the connection string name in the appsettings.json file that sets up the site connection automatically.

Moving around in your code

You can move the insertion point to the previous locations by pressing Ctrl+-, or return to a more recent location from the previous location by pressing Ctrl+Shift+-. The maximum number of forward/backward movements is 20.

Using the navigation bar

The navigation bar, which appears when you begin to edit code in a code base, allows you to navigate to code in the code base.

You will find that there are several dropdown boxes on the navigation bar. You can use the dropdown boxes to navigate in various ways.

  • The left dropdown allows you to navigate to another project that hosts the current file.
  • The middle dropdown allows you to navigate to a class/type in the current file.
  • The right dropdown allows you to navigate directly to a procedure or other member of a class.
  • You can press Tab to shift focus between the dropdown boxes on the navigation bar.
Finding all references or navigating to references

Find All References allows you to see where specific elements are referenced in the code base. To find all references for a particular element, select the element, and then press Shift+F12 or select Find All References from the right-click context menu.

A tool window named 'element' references appears (element being the name of the selected item), with the references displayed in a list.

In the references tool window, you will find a toolbar at the top, which allows you to:

  • Click on buttons to go to the previous or next location in the reference list.
  • Keep the current search results window by selecting the Keep Results button. If this button is selected, the current search results stay in this window, and new search results appear in a new window.

To navigate directly to a reference in your code, simply select the reference in the references window. To move your reference up and down in the references list, select the Go To Previous Location/Go To Next Location icons.

Finding code using Go To commands

To go to a definition,

  1. Place the insertion point at a particular symbol.

  2. Right-click the symbol and then select Go To Definition, or simply press F12. Alternatively, you can press the Ctrl key and then click on the symbol that becomes clickable when your mouse hovers over it.

To go to an implementation,

  1. Place the insertion point inside a symbol.

  2. Press Ctrl+F12 or select Go To Implementation from the right-click context menu.

Improving your code

After you have finished editing your code in SnapDevelop, you need to figure out whether your code works properly. SnapDevelop offers an integrated set of project building, debugging, and testing tools that can be used to detect problems in your code.

Like most other IDEs, SnapDevelop tests your code in two separate phases:

  • Building code, which catches and fixes project and compiler errors.
  • Running code, which detects runtime errors.
Building your code

SnapDevelop supports two basic types of build configuration: Debug and Release, and uses Debug as the default build configuration.

To build your entire solution, simply press F6 or select Build > Build Solution on the toolbar.

To build a specific project in your solution, set the project as the startup project first, and then press Shift+F6 or select Build > Build on the toolbar (project being the name of the specified startup project).


You can watch the build process in the the Output pane and view errors and warnings in the Error List pane. Should any error occur or the number of warnings exceed the specified level, your build fails. In this case, you need to click on the errors and warnings to go to the corresponding lines, resolve the errors, and then rebuild your solution/project.

Checking the error list

When you build your solution/project, you may encounter a variety of errors and warnings. To view these errors and warnings, navigate to the the bottom of the Output pane, and select the Error List tab.

Double-click on the error line in the Error List pane to go to the corresponding line in your code. You will notice that the error is marked with a red squiggle underscore. Hover your mouse over it for error details, and resolve the error according to the detailed information.

Fixing or refactoring code using quick actions

You can use Quick Actions to resolve errors. For details about how to fix and refactor code using Quick Actions, refer to Generating and Refactoring Code.

Debugging

Refer to Debugging Your Code for details on how you can run unit tests in SnapDevelop.

Running unit tests

Refer to Unit Testing for details on how you can run unit tests in SnapDevelop.

Working with data

Creating a connection to a database

To create a connection to a database, select View > DB Server Explorer and then click the Add Connection icon in Server Explorer.

Then, you will see the Database Connection dialog box. If you haven't yet created a database connection, you need to select New to create a new one. If you have created a database connection, you can directly use the existing connection configurations, or select Edit to modify the configurations.

Select the desired database provider from the Database provider dropdown list, provide the necessary credentials, and then then select the specific database to connect.

After you have specified the data source, you can click Test Connection to see if the connection succeeds. If the connection succeeds, you can use and manipulate data from the connected database. If the connection fails, you need to troubleshoot based on the documents of the corresponding database provider.

Saving and editing connection strings

Connection strings in SnapDevelop applications are stored in the application settings file. If you want to modify the connection strings, you can find and edit them in the application settings file.

To save a connection string using the data source configuration wizard:

In the Data Source Configuration Wizard, select the Save connection string in configuration file as check box to save the connection string.

The connection string will be stored in this path: C:\Users\appeon.sd\1.0.1

To save a connection string directly into application settings:

  1. In Solution Explorer, right-click on the project node and then select Add > New Item to bring up the New Item dialog box.
  2. Select DataContext in the middle pane.
  3. Specify a name for the DataContext.
  4. In the Data Source Configuration Wizard that appears, verify that the connection string is valid.
  5. Click OK to complete the process.

After the process is complete, you can check the appsettings.json file in your project in Solution Explorer.

To change connection strings stored in application settings:

You can change connection information stored in the appsettings.json file. To change connection information:

  1. Open the appsettings.json file in Solution Explorer.
  2. Locate the connection you want to change and modify the corresponding values in the connection.
  3. Save the changes.
Performing SQL queries

An independent tutorial on how to perform SQL queries in SnapDevelop is available on the following link: https://docs.appeon.com/appeon_online_help/snapdevelop2019r2/Performing_SQL_Queries/index.html

Managing NuGet Packages

The NuGet Package Manager in SnapDevelop allows you to install, uninstall, and update NuGet packages for your projects and solutions. It has three tabs, each tab displaying a list of related packages on the left side of the manager and details about the selected package on the right side.

  • Browse, which displays packages to install. If a package is already installed, the Install button on the right side changes to Uninstall.

  • Installed, which displays all installed and loaded packages. A green dot next to a package indicates that the package is already loaded. The red X icon to the right of a package or the Uninstall button on the right side of the manager can be used to uninstall the package. A blue up arrow to the right of a package can be used to update the package if a newer version of the installed package is available.

  • Update, which displays packages that have available updates from the currently selected package source.

There is a search box on the upper left side of the manager that you can use to filter the list of packages.

Managing packages for single projects

Finding and installing a package

  1. In Solution Explorer, select either a project node or Dependencies node and then select Manage NuGet Packages from the right-click context menu.

  2. Select the Browse tab to display packages from the currently enabled package source. Search for the desired package using the search box on the upper left side of the package manager and select the package to view its detailed information.

    Note

    To include prerelease versions in the search, and to make prerelease versions available in the Version drop-down, select the Include prerelease option.

  3. Select the desired version from the Version drop-down and select Install. SnapDevelop installs the package and its dependencies into the project. You may be asked to accept license terms. When installation is complete, the installed package appears under the Installed tab and in the Dependencies node in Solution Explorer, indicating that you can use the using directives to refer to them in your project.

Uninstalling a package

  1. In Solution Explorer, select either the desired project node or Dependencies node and then select Manage NuGet Packages from the right-click context menu.

  2. Select the Installed tab to display all installed packages.

  3. Select the package to uninstall and select Uninstall.

Updating a package

  1. In Solution Explorer, select either the desired project node or Dependencies node, and then select Manage NuGet Packages from the right-click context menu.

  2. Select the Update tab to display packages that have available updates from the enabled package source. Select Include prerelease to include prerelease packages in the update list.

  3. Select the package to update, select the desired version from the Version drop-down list, and select Update.

    To update multiple packages to their latest versions, select them individually in the list or enable the Select all packages option and select the Update button above the list.

Managing packages for solutions

If you want to manage NuGet packages for multiple projects simultaneously, it is recommended that you manage packages for the entire solution. Compared with the package manager for single projects, the package manager for solution has a Consolidate tab, in addition to the three tabs.

To manage packages for solution, you:

  1. Select the solution and Manage NuGet Packages for Solution from the right-click context menu. Alternatively, select Tools > NuGet Package Manager > Manage NuGet Packages for Solution.

  2. When you are managing packages for the entire solution, you are required to select the affected project(s).

Consolidating package versions

It is uncommon to use different versions of the same NuGet package across different projects in the same solution. When you manage NuGet packages for solution, you will see a Consolidate tab, which allows you to easily see where packages with distinct version numbers are used by different projects in the solution.

To consolidate package versions, you:

  1. Select the project(s) to update in the project list.

  2. Select the version to use in all those projects from the Version dropdown.

  3. Select Install.

The Package Manager installs the selected package version into all selected projects. Then, the package disappears from the list under the Consolidate tab.

Specifying package sources

To change the source from which SnapDevelop obtains packages, select the desired one from the Package source dropdown list:

For information on how to manage package sources, refer to Package Sources.

Understanding the package manager options

When you select a package, you will see an expandable Options control below the version selector. For some project types (for example, .NET Core projects), only the Show preview window option is provided.

Showing preview window

If you enable the Show preview window option, a window shows the dependencies of a selected package before the package is installed.

Install and update options

Dependency behavior specifies how NuGet selects the version of dependent packages to install.

OptionDescription
Ignore DependenciesDoesn’t install any dependencies.
LowestInstalls the dependency with the minimum version number that meets the requirements of the primary selected package. It is the default option.
Highest PatchInstalls the version with the same major and minor version numbers but the highest patch number. If version 3.2.2 is specified, for instance, the highest version starting with 3.2 will be installed.
Highest MinorInstalls the version with the same major version number but the highest minor number and patch number. If version 3.2.2 is specified, for instance, the highest version starting with 3 will be installed.
HighestInstalls the highest available version of the package.

File conflict action specifies how NuGet deals with packages existing in the project or local machine.

OptionDescription
PromptRequires NuGet to ask whether to retain or overwrite existing packages.
Ignore AllRequires NuGet to skip overwriting any existing packages.
Overwrite AllRequires NuGet to overwrite any existing packages.

Uninstall options

OptionDescription
Remove dependenciesRemoves any dependent packages not referenced elsewhere in the project.
Force uninstall, even if there are dependencies on itUninstalls a package even if it is still being referenced in the project. This option is often used together with Remove dependencies to remove a package. However, applying this option may lead to broken references in the project.

Source Control

SnapDevelop currently supports two types of source control systems:

  • SnapDevelop Git;
  • SnapDevelop SVN (To use SnapDevelop SVN, make sure that you have installed TortoiseSVN 1.9 or a later version).

This section describes how you can perform source control using SnapDevelop Git or SnapDevelop SVN in SnapDevelop. You will learn how to:

  • Configure source control plug-in;
  • Work with Git source control using SnapDevelop Git, including:
    • Create a Git repository;
    • Connect to a Git repository;
    • Commit changes to a Git repository;
    • Sync code changes to a Git repository;
    • Share code among the team;
    • View Git commit history;
  • Work with Subversion source control using SnapDevelop SVN, including:
    • Import code into a Subversion repository;
    • Check out a working copy of a Subversion repository;
    • Commit changes to a Subversion repository;
    • Update a local working copy;
    • Merge different revisions;
    • Resolve conflicts;
    • Lock/release a file.

Configuring source control plug-in

Two source control plug-ins, SnapDevelop Git and SnapDevelop SVN, are provided by default when you install SnapDevelop. In SnapDevleop IDE, you can add a solution (instead of single projects) to Git source control which uses SnapDevelop Git plug-in, or Subversion source control which uses SnapDevelop SVN plug-in.

Although you cannot add a solution to two different source control systems directly in SnapDevelop IDE, you may do it using a third-party source control client. If your solution is in the repositories of two different source control systems at the same time, you can decide which source control system to use for the solution in the SnapDevelop IDE using the Plug-in Selection option.

Working with Git source control using SnapDevelop Git

Git source control allows you to fully copy a remote repository housing the source code to your own computer. You can then commit the changes on your own computer and perform source control operations without network connection. When you need to switch contexts, you can create a private local branch. You can quickly switch from one branch to another to pivot among different variations of your codebase. Then, you can merge, or publish the branch.

Creating a Git repository

Manage a SnapDevelop solution in Git by creating a repo for them. Later you can connect this Git repo to a remote Git repo to share your work with others.

Creating a local Git repository

From an existing solution

To create a repository from an existing solution not in source control, select Add to Source Control in the bottom right corner of the SnapDevelop IDE. This creates a new Git repository in the same directory as your solution and opens up the Push view in Team Explorer, which allows you to push your code to a remote Git repository.

In an empty folder

Open the Connections view by selecting the Manage Connections icon in Team Explorer. Under Local Git Repositories, select New and enter a folder where the repository will be created. This directory must be empty. Then, select Create to create the repository.

Creating a remote Git repository

You may need to create a remote Git repository to which your local repository can connect so that you can share your code with other developers. For the purpose of demonstration, we signed up for the Bonobo Git Server and created a new Git repository.

Cloning an existing Git repository

In the Connections page in Team Explorer, you can copy an existing Git repository to your local computer. Before you can copy the Git repository, you are required to provide its URL, which represents the source of the repository you want to clone. If you want to clone a particular Git repository on the Bonobo Git Server, for example, you simply select the repository and then copy the Git URL.

Connecting to a remote Git repository

To connect a local repository to a remote Git repository to share your code, go to the Settings page in Team Explorer. Under Remotes, select Add. Enter ‘origin’ in the Name field and enter the clone URL for your repository in the Fetch field. Make sure that Push matches fetch is checked and select Save.

Specifying global settings

Providing user name and email

You need to specify the user name and Email address so that your team members can know exactly who committed changes to the branches and, if necessary, contact the user who committed the changes.

Adding remotes

You need to add a remote Git repository so that you can specify the name of the remote repository (usually ‘origin’) and the URL of the repository that you can use for fetch and push purposes. The push and fetch URLs are the same by default. If you want them to be different, you can uncheck the Push matches fetch box.

Working with Git tags

Creating a tag

In SnapDevelop, you can create lightweight tags, which are a pointer to specific commit. To create a tag, you need to:

  1. In Team Explorer, select Tags and then Create Tag.

  2. To select a branch to create a tag from, designate a tag name in the Enter a tag name box (no space allowed), optionally supply a tag message, uncheck the Create tag against tip of current branch box, select a branch from the Select a branch dropdown list and select Create Tag.

    To create a tag against the tip of the current branch, designate a tag name in the Enter a tag name box (no space allowed), optionally supply a tag message, check the Create tag against tip of current branch box, and select Create Tag.

  3. Right-click the new tag and select Push to push it to the remote repository. Select Push All to push all new local tags to the remote repository.

Deleting a tag

To delete a local tag, you right-click the tag to delete and select Delete Locally.

Creating a branch from a tag

Take the following steps to create a branch from a tag:

  1. Select Create Branch From Tag; Alternatively, right-click a tag and select New Local Branch From.

  2. Specify a branch name, select a tag from the local tag list, optionally check the Checkout branch box (if you want to check out the newly created branch) and then select Create Branch.

  3. Select Branches from the Home view to view your newly created branch.

  4. Right-click the new tag and select Push Branch to push the branch to the remote repository.

Viewing tags
Viewing tags in the tags view

You can select Tags from the Home view to view all tags in a local repository. All tags are listed under the currently connected repository. If you want to learn more about the tagged commit, you can right-click the tag and then select View Commit Details.

Viewing tags in the history view

You can also view tags by following the steps below:

  1. Navigate to the Branches view.

  2. Right-click the desired branch.

  3. Select View History from the right-click context menu.

  4. Select the Show Tags icon in the upper left corner of the History view that appears.

Saving changes with commits

When you have finished editing the files in Solution Explorer, you can go to the Changes page in Team Explorer to commit your changes to your repository. Git does not automatically snapshot your code as you edit the files in your local repository. You need to tell Git exactly what changes you want to add to the next snapshot before you can create a commit to save the snapshot to your repository.

You are offered three commit options:

  • Commit All, which means that you can commit all changes to the local branch.

  • Commit and Push, which means that you can commit all changes to the local branch and then push the changes to the remote repository.

  • Commit and Sync, which means that you can commit all changes to the local branch and then synchronize synchronizes the commits on the local and remote branch.

A commit contains the following information:

  • A brief description of what changes you have made in the commit.

  • A snapshot of the changed files saved in the commit.

  • A reference to the parent commit(s).

Working with Git branches

Git branches are simply a reference that records the history of commits. A Git branch allows you to isolate changes for a feature or a bug fix from the master branch, which makes it very easy to change what you are working on by simply changing your current branch. You can create multiple branches in a repository and work on a branch without affecting the other branches, and you can share branches with your team members without merging the changes into the master branch.

It is easy to switch between branches in the same repository because the branches are lightweight and independent. When working with branches, Git uses the history information stored in commits to recreate the files on a branch, rather than creating multiple copies of your source code.

Creating a Git branch

Take the following steps to create a Git branch:

  1. In Team Explorer and then open the Branches view.

  2. Right-click the parent branch (usually master) to base your changes and then select New Local Branch From.

  3. Give a branch name in the required field, (optionally) check the Checkout branch box (SnapDevelop automatically checks out to the newly created branch), and then click Create Branch.

Deleting a Git branch

Take the following steps to delete a Git branch:

  1. In Team Explorer and then open the Branches view.

  2. Locate the branch you want to delete. Make sure the branch is not checked out since you can't delete the branch you are currently working in.

  3. Right-click the branch name and select Delete.

Sharing code with Push

If you have committed changes to the branches in the local repository, you can then share your code with team members by pushing your local branches to the remote repository. Your commits are added to an existing remote branch or to a new remote branch that contains the same commits as your local branch. Team members can then fetch or pull your commits from the remote repository and review the commits before merging them into the master branch of their local repository.

Take the following steps to share your code in the local repository:

  1. In Team Explorer and select Home and then Sync.

  2. Select Push to upload your commits to the remote branch.

Updating code with Sync, Fetch, Pull, Merge and Rebase

Synchronizing local/remote commits with Sync

The Sync command pulls remote changes and then pushes local ones. It synchronizes the commits on the local and remote branches.

Take the following steps to synchronize the local/remote commits:

  1. In Team Explorer, select Home and then Sync.

  2. Select Sync.

Downloading changes with Fetch

The Fetch command allows you to download all commits and new branches pushed to the remote repository but absent in your local repository into your own local repository. It downloads the new commits for your review only, without merging any changes into your local branches.

Take the following steps to fetch changes from the remote repository:

  1. In Team Explorer, select Home and then Sync.

  2. Select Fetch.

Fetching and merging with Pull

The Pull command performs a fetch and then a merge to download the commits and integrate them into your local branch.

Take the following steps to perform a pull operation.

  1. In Team Explorer, select Home and then Sync.

  2. Select Pull.

Updating branches with Merge

The Merge command takes the commits retrieved from fetch and integrates the latest changes from one branch into another.

Take the following steps to merge the latest changes from one branch into another:

  1. In Team Explorer, select Home and then Branches.

  2. Check out your target branch and then select Merge.

  3. Select a source branch from the Merge from branch dropdown list.

  4. Check the box for Commit changes after merging (optional) and then select Merge.

    Note

    If any merge conflict occurs, you will see a message reminding you to resolve the conflict and commit the change. Refer to Resolving Merge Conflicts for instructions on how to resolve merge conflicts.

Updating branches with Rebase

Rebase serves to address the problem of updating a branch with the latest changes from the main branch. It takes the commits in your current branch and replays them on the commit history of another branch. The commit history of your current branch will be rewritten so that it starts from the most recent commit in the target branch, thus keeping a clean commit history.

Take the following steps to perform a rebase operation:

  1. In Team Explorer, select Home and then Branches.

  2. Check out your source branch for rebasing and then select Rebase.

  3. Select a target branch from the Onto branch dropdown list.

  4. Select Rebase.

Resolving merge conflicts

If any merge conflicts occur, you need to resolve the conflicts manually.

Reviewing commit history

Git manages a full history of your development by using the parent reference information stored in each commit. The commit history allows you to figure out when file changes are made, who made the changes, and what differences exist between the various versions of commits.

To review the commit history, you:

  1. Navigate to the Branches view.

  2. Right-click the desired branch.

  3. Select View History from the right-click context menu.

Working with Subversion source control using SnapDevelop SVN

Subversion source control system maintains all your files, including a complete history of all changes to the files, in a central database called repository. With SnapDevelop SVN in SnapDevelop, you can save changes to your repository with commits, show what changes are made to the repository and who makes the changes, merge various revisions, update your code to a particular revision, and resolve conflicts, if any.

Importing code into a Subversion repository

To use SnapDevelop SVN for source control, you need to select Add to Source Control in the bottom right corner of the SnapDevelop IDE and then select SnapDevelop SVN.

Then, verify the working copy root.

Importing code into a new repository

If you want to import your solution to a new repository, you should:

  1. Select the New Repository radio button.

  2. Specify the location of the new repository. The new repository can be created on the local disk or on a remote server.

  3. Select Import to add your solution to the new repository.

  4. Select Finish to close the Add Solution to Subversion dialog box.

Importing code into an existing repository

If you want to import your solution to an existing repository, you should:

  1. Select the Existing Repository radio button.

  2. Enter the URL of the existing repository.

  3. Select Import to add your solution to the existing repository.

  4. Select Finish to close the Add Solution to Subversion dialog box.

Checking out a working copy

You need to check out a working copy from the connected repository. In so doing, you need to specify a directory where you want to place your working copy. Right click in the directory so that the context menu pops up and then select the SVN Checkout command.

In the Checkout dialog box that appears, specify the URL of the repository and the checkout directory, and leave the default settings unchanged.

Committing changes to the connected repository

When you have checked out a working copy from the repository, you can edit and modify the files in Solution Explorer. When you have finished modifying a file, you can commit your changes to the remote repository so that other team members can see your changes and update the changes to their own local working copy.

Note: It is recommended that you always commit the whole project or solution folder instead of a single file or folder. If you commit a single file or folder, it is possible that another user may fail to get the updated version correctly.

To save changes with commits, you simply select the modified project, or solution and then select Commit from the right-click context menu.

Then, you will see the Commit dialog box, which displays the changed files, such as versioned, non-versioned, added, and deleted files. The changed files are selected by default. If you don’t want a changed file to be committed, you can simply uncheck that file. If you want to commit a non-versioned file, you can check that file. You can quickly check or uncheck files by clicking the links immediately above the list of displayed items. In addition, you need to enter a message that describes the changes you have made so that your team members can know what happened.

Updating your local working copy

When working on a project involving multiple developers, you should periodically ensure that the changes made by your team members are updated into your local working copy.

Note: It is recommended that you always update the whole project or solution folder instead of a single file or folder. If you update a single file or folder, it is possible that you may fail to get the updated version correctly.

Two update options are offered in SnapDevelop: update to the latest revision and update to a non-latest revision.

Updating to the latest revision

To update your local working copy with the latest changes from the remote repository, you simply select a desired project, solution, or directory, and select Update from the right-click context menu.

Updating to a non-latest revision

To update your local working copy with the changes from a specific earlier revision, you need to:

  1. Select a desired project, solution, or directory.

  2. Select SnapDevelop SVN and then Update to Revision from the right-click context menu.

  3. Specify the specific revision.

Refreshing status

After a project is loaded into the SnapDevelop IDE, it might be changed outside the IDE. For example, if a developer merges certain changes from the other revisions, such changes will not be detected by the SnapDevelop IDE. Therefore, you need to reload the project into the IDE by selecting an affected file, folder, project or solution and selecting Refresh Status from the right-click context menu.

Showing change lists

When you have modified the files, you can view the changes by selecting a modified file, project, or solution and then SnapDevelop SVN > Show Changes from the right-click context menu before committing the changes to the Subversion repository.

Showing revision logs

For every change you make and commit, you should provide a log message so that you can later figure out what changes you made and why you made such changes.

To view the file revision logs, you need to select a particular file, folder, project, or solution and then SnapDevelop SVN > Show Log from the right-click context menu.

Reverting changes

If you change a file in your solution and you find that the changes are not appropriate, you can undo the changes by selecting the modified file and SnapDevelop SVN > Revert Changes from the right-click context menu. Note that you can revert changes only when they are not committed to the Subversion repository.

Specifying Subversion properties

You can read and set the Subversion properties in the Subversion property page. To go to this page, select a particular file, folder, project or solution and SnapDevelop SVN > Properties from the right-click context menu.

Merging

Branches are used to maintain separate lines of development. At some stage of development, you need to merge the changes made on one branch back into the trunk, or vice versa. SnapDevelop allows you to perform two types of merge: merge a range of revisions and merge two different trees.

Merging a range of revisions

To merge a range of revisions, you need to:

  1. Specify the URL of the branch that contains the changes you want to incorporate into your local working copy.

  2. Specify the list of revisions you want to merge.

Merging two different trees

To merge two different trees, you need to:

  1. Specify the URL of the trunk in the From field.

  2. Specify the URL of the feature branch in the To field.

  3. Enter the revision number at which the two trees are synchronized in both the From and To fields.

Resolving conflicts

Conflicts may occur when more than one developer is changing the same lines of code in the same file and committing the changes to the shared repository.

If any conflict occurs, you will see the name of the conflicted file(s) and a warning message.

In Solution Explorer, the conflicted file(s) will be marked with a little red dot. You have to resolve the conflict(s) manually if you want to synchronize the code successfully.

Editing text conflicts

To resolve conflicts, you need to:

  1. Select the conflicted file (marked with little red dot).

  2. Select SnapDevelop SVN and Edit Text Conflicts from the right-click context menu.

  3. Edit the text conflicts.

Marking as resolved

When you have resolved the text conflicts, you can mark them as resolved by selecting SnapDevelop SVN > Mark as Resolved from the right-click context menu.

Locking

No file is locked by default and any team member who has commit access can commit changes to any file in the repository. If you lock a file, only you can commit changes to that file, and commits by other team members will be rejected until you release the lock. A locked file cannot be modified in any way in the repository.

Getting a lock

To lock a file, you simply select the file in your working copy and then select SnapDevelop SVN > Get Lock.

Then, you will see the Lock Files dialog box, where you can optionally enter a message so that your team members can see why you have locked the file. If you want to steal the locks from someone else, you can check the Steal the locks box.

Releasing a lock

To release a lock, you should first know which file is locked. Locked files are displayed in the commit dialog box and selected automatically. If you proceed with the commit, the locks on the selected files are removed even if the files haven’t been modified. If you don’t want to unlock particular files, you can uncheck them. If you want to keep a lock on a file you have modified, you have to check the Keep locks box before committing your changes.

You can release a lock manually by selecting the locked file in your working copy and then selecting SnapDevelop SVN > Release Lock.

Tracking changes with Blame

Blame displays the author and revision information for the specified files or URLs. Each line of text is annotated at the beginning with the user name and the revision number for the last change to that line.

Showing disk-browser and repo-browser

The repository browser allows you to view the structure and status of the repository and to work directly on the repository without checking out a working copy.

To display the repository in your local disk, select a file, folder, project or solution and SnapDevelop SVN > Disk-Browser.

To display the repository in the repository browser, select a file, folder, project or solution and SnapDevelop SVN > Repo-Browser.

Excluding from Subversion/adding to Subversion

Sometimes you don’t want to commit all edited files into the central Subversion repository. In the event that you want to selectively commit the edited files, you can do this by selecting the files you don’t want to include in the repository and selecting SnapDevelop SVN > Exclude from Subversion.

When you have excluded a file from Subversion, the little (yellow or green) dot preceding the file in Solution Explorer disappears. You can add the file to Subversion by selecting the file and then Add to Subversion from the right-click context menu.

Scaffolding Services and Controllers

An independent tutorial on how to scaffold services and controllers in SnapDevelop is available on the following link: https://docs.appeon.com/appeon_online_help/snapdevelop2019r2/Scaffolding/index.html.

Unit Testing

Use SnapDevelop to run unit tests to keep code health, and find errors before the release of an application. Run your unit tests frequently to make sure your code is working properly.

Adding a new xUnit test project to an existing solution

Opening an existing project for testing

Load the starting project that you downloaded from here. Now, open the Calculator.cs file, we need to add the actual business logic to it. This is how the Calculator class should be:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Calculator
{
    public class Calculator
    {
        public static double Addition(double num1, double num2)
        {
            return num1 + num2;
        }

        public static double Subtraction(double num1, double num2)
        {
            return num1 - num2;
        }

        public static double Multiplication(double num1, double num2)
        {
            return num1 * num2;
        }

        public static double Division(double num1, double num2)
        {
            return num1 / num2;
        }
    }
}

As you can see, it is a very simple class. It only performs some very simple operations and returns the result of each operation. But this is enough to start using the xUnit Test projects.

Also notice the use of the static keyword. We will use this to avoid having to instantiate it later on.

Creating an xUnit Test (.NET Core) project

Let's add a new xUnit Test project to our solution. Right-click on the solution. Then click on Add > New Project.

Name the project Calculator.Tests and click OK.

This will create a simple project with one class for the basic starting point of your tests.

Since we will create our own class to test our code, we can proceed to delete this object. So, right-click on the UnitTest1.cs object and then select Delete.

Performing unit test using the Fact attribute

Adding a test class

Then create your own class by right-clicking on the Calculator.Tests project and selecting Add > Class. Name it CalculatorTests.cs and click OK.

The following code will be generated for CalculatorTests class. Delete the Test1() method and the [Fact] attribute.

using System;
using Xunit;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Calculator.Tests
{
    public class CalculatorTests
    {
      	// ***Delete these lines of code*** //
        [Fact]
        public void Test1()
        {

        }
      	// ******************************* //
    }
}

Now that we have our testing class, we will create a reference to our actual development project. In order to do that, expand the Dependencies item of the Calculator.Tests project. Then right-click on it and select Add Reference….

Then select the checkbox for the project Calculator and click OK.

This will add a reference to our project and make it available to our testing project.

Our class is ready for us to start coding our tests.

using System;
using Xunit;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Calculator.Tests
{
    public class CalculatorTests
    {
        
    }
}

Developing the test method

Here is where we start developing our first method that will test the Addition method from our Calculator class. The coding of our tests will be done on the CalculatorTests class, and any required changes to the actual app will be done to the methods of the Calculator class.

One very useful thing to keep in mind is to applying a naming convention for our test methods. One of these conventions states that you need to use the word Should in the name of your test method in order to make it clear that the method should perform certain testing task. But for this section we will use our own naming convention that will start with the name of the method to test, then a simple and short explanation of what it should do. So we will name it:

public void Addition_ShouldCalculateSimpleValues()
{
  
}

Notice that it returns void. That is because testing methods usually don't need to return any value. So this method will test the Addition method.

The testing methods usually have three main sections inside of its lines of code: Instantiation, Action and Assertion.

The Instantiation section is where we set up what's needed for the test to run. The Action section is where we define the method that we want to test, and any other operations needed for it to run. Then, the Assertion section is where we actually assert that the method should do what we expect it to do. For that, we will use the Assert object.

The Assert object has many APIs that help you determine if the test passed or failed. You can find all of the APIs of Assert using the Intelligent Code Completion feature of the SnapDevelop IDE.

So let's add the code to our test method for the actual Test:

[Fact]
public void Addition_ShouldCalculateSimpleValues()
{
    // Instantiation
    double expected = 9;

    // Action
    double actual = Calculator.Addition(3, 6);

    // Assertion
    Assert.Equal(expected, actual);
}

Notice how we decorated our test method with the attribute [Fact]. That is because there are mainly two different types of test methods:

  • Facts are tests which are always true. They test invariant conditions.
  • Theories are tests which are only true for a particular set of data.

We will start by testing a Fact because we know, for sure, that 3 plus 6 equals 9. We'll test a Theory after that in this section.

So now, click on the Test > Test Explorer menu option to open the Test Explorer window.

You will notice that our test already appears there:

Running your test!

It's time to run your test! Click on Run All in the Test Explorer window. Wait a few seconds for the projects to build and the test to run. Then you will notice that the test has actually passed!

This was an actual test that asserts that if you pass a 3 and a 6 to the Addition method, it should return 9.

Performing unit test using the Theory attribute

Even though this was very simple, it illustrates the basics of how Facts are developed and tested against our code. But we will now perform a more close to the real-world test, where we want to test Theories that challenge our code against several different set of values, thus actually testing different scenarios that our methods could, would, or should stumble upon. So, we'll change our Fact to a Theory.

Developing the test method

Theories usually test different scenarios, or values, of data. We need to pass these values to our test method. In order to do that, we use the [InlineData] attribute. This attribute will set the different scenarios that will test the different values of our data. We will now add some of these scenarios to our method:

[Theory]
[InlineData(3, 6, 9)]
[InlineData(4, 3, 7)]
[InlineData(-10, 10, 0)]
[InlineData(34, 5.33, 39.33)]
[InlineData(-10, -10, -20)]
public void Addition_ShouldCalculateSimpleValues(double num1, double num2, double expected)
{
    // Action
    double actual = Calculator.Addition(num1, num2);

    // Assertion
    Assert.Equal(expected, actual);
}

Notice the changes we made to our method. We have added three new parameters in order to receive the values from our Theory. Plus, calling our actual method, it passes the parameters making it more real-worldish.

If we do a build to our solution (press F6), you will notice that now, each one of, the InlineData attributes we added have become tests in our Test Explorer window.

Running your test!

We can now click on Run All again to run all our tests. They should all pass!

Fixing a failed test

So far we have tested theories that all pass. But what if one of them didn't? Well, that's the whole purpose of this approach. How to tackle a test that doesn't pass? What to do next? Well… let's see another test method example:

[Theory]
[InlineData(8, 4, 2)]
[InlineData(-9, 3, -3)]
[InlineData(15, 0, 0)]
public void Division_ShouldCalculateSimpleValues(double num1, double num2, double expected)
{
    // Action
    double actual = Calculator.Division(num1, num2);

    // Assertion
    Assert.Equal(expected, actual);
}

This testing method example, tests three theories of the Division method.

If you run these tests, you'll notice that one of them fails.

But this is actually useful information, because it is telling us that our method is not prepared to divide by zero and return a zero. It is actually returning undetermined or infinite.

This means that we need to refactor our code so that it can pass this particular test too. And this is where we actually make changes to our Calculator class in order to comply with all the requirements, or tests, that our method should.

Calculator.cs

public static double Division(double num1, double num2)
{
    if (num2 == 0)
    {
        // Refactored logic for Division by zero
        return 0;
    }
    else
    {
        return num1 / num2;
    }
}

And, since we now know for a Fact that all divisions by zero should return zero, then we can make that test a Fact:

CalculatorTests.cs

[Theory]
[InlineData(8, 4, 2)]
[InlineData(-9, 3, -3)]
public void Division_ShouldCalculateSimpleValues(double num1, double num2, double expected)
{
    // Action
    double actual = Calculator.Division(num1, num2);

    // Assertion
    Assert.Equal(expected, actual);
}

[Fact]
public void Division_ShouldDivideByZero()
{
    // Instantiation
    double expected = 0;

    // Action
    double actual = Calculator.Division(15, 0);

    // Assertion
    Assert.Equal(expected, actual);
}

If we build the solution (press F6), the tests in the Test Explorer window will update.

At this point, if we Run All the tests again, then all our tests should pass!

This is exactly what we are aiming for!

Debugging your tests

Now that we have several tests, there may be the need to debug a test to make sure that it is actually doing what it is expected to do. This is actually quite simple: First you need to add a breakpoint to your code. You can do that by clicking on the grey sidebar on the Code Editor window in the line you want to add the breakpoint to, or by right-clicking on the line of code where you want to insert the breakpoint, and then selecting Add > Insert breakpoint.

Then right-click on the test you want to debug, and select Debug Selected Tests.

Now you can continue debugging your code as you would normally do.

Final notes

Keep in mind that:

  • You should develop your code to pass your tests, not develop your tests so that your code can pass your tests.
  • You want to create tests for as many possible scenarios (Facts and Theories) as you can. This provides confidence that you will deploy better working code to production.
  • Your testing project (Calculator.Tests in this section) is not necessarily needed in a production environment. In fact, in most cases, it can be a big No, no!
  • xUnit Test projects are actually projects that will assist you to develop better working code from the very beginning.

We encourage you to continue creating tests for this Calculator class to better grasp the concepts mentioned in this section.

Debugging Your Code

Debugging is used to track the running process of code. Exceptions may occasionally occur during the running of a program. A debugger can be used to effectively and accurately locate an exception so that you can fix it in a timely manner.

This section presents a brief introduction to the basic features of the SnapDevelop debugger in a step-by-step manner. You will learn to:

  • Set a breakpoint;
  • Navigate code in the debugger;
  • Check variables via data tips and Locals window;
  • Add a watch on a variable;
  • Check the call stack.

Creating a project

This section shows you how to create a C# project using SnapDevelop and to add code that can help to demonstrate the key features of the SnapDevelop debugger. The code added here is simple enough for demonstration purposes.

  1. Open SnapDevelop.

    From the top menu bar, choose File > New > Project. In the left pane of the New Project dialog box, under C#, choose .NET Core, and then in the middle pane choose Console App (.NET Core). Then, give a name for the project and click OK.

    SnapDevelop creates the project.

    . In Program.cs, replace the current code

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    namespace Debugging
     {
       	 class Program
        	{
            	static void Main(string[] args)
            	{
                	Console.WriteLine("Hello World!");
            	}
       	 }
     }
    

    with the following code:

    using System;
    using System.Collections.Generic;
    
    public class Animal
     {
     	public int X { get; private set; }
     	public int Y { get; private set; }
     	public int Appetite { get; set; }
     	public int Weight { get; set; }
     	public virtual void Feed()
     		{
     			Console.WriteLine("Performing base class feeding tasks");
     		}
     }
    
     class Dog : Animal
     {
     	public override void Feed()
     		{
     			Console.WriteLine("Feeding a dog");
     			base.Feed();
     		}
     }
    
     class Cat : Animal
     {
     	public override void Feed()
     		{
     			Console.WriteLine("Feeding a cat");
     			base.Feed();
     		}
     }
    
     class Pig : Animal
     {
     	public override void Feed()
     		{
     			Console.WriteLine("Feeding a pig");
     			base.Feed();
     		}
     } 
    
     class Program
     {
     	static void Main(string[] args)
     		{
     			var animals = new List
     				{
     					new Dog(),
     					new Cat(),
     					new Pig()
     				};
                      foreach (var animal in animals)
                            {
     						animal.Feed();
                            }
     					Console.WriteLine("Press any key to exit.");
                            Console.ReadKey();
                }
     }
    

Launching the debugger

  1. Press F5 (or select Debug > Start Debugging) or the Debugging button on the toolbar.

    F5 starts the app with the debugger attached to the app process. Since nothing was done to debug the code, the app just loads and generates the following console output.

    Feeding a dog
    Performing base class feeding tasks
    Feeding a cat
    Performing base class feeding tasks
    Feeding a pig
    Performing base class feeding tasks
    Press any key to exit.
    
  2. Stop the debugger by pressing the red stop button on the toolbar.

Setting a breakpoint and launching the debugger

Breakpoints are the most basic feature of the SnapDevelop debugger. A breakpoint indicates where the debugger should suspend your running code so that you can look at the values of variables, or whether or not a block of code is executed.

  1. In the foreach loop of the Main function, set a breakpoint by clicking animal.Feed() and then pressing F9:

    A red dot appears in the left margin of the line of code you clicked.

    If you want to delete or disable the breakpoint, you just hover over the breakpoint, right-click your mouse and make the choice accordingly.

  2. Press the Debugging button or F5, the app launches, and the debugger runs to the line of code where you set the breakpoint.

    The yellow arrow in the left margin points to the line of code where the debugger paused, which suspends app execution simultaneously (this line of code has not yet been executed).

    If the app is not yet running, F5 launches the debugger and stops at the first breakpoint. Otherwise, F5 continues running the app to the next breakpoints (if any).

Breakpoints are useful when you know a block of code or a line of code that you decide to examine in detail.

Usually we use the step commands (step into, step over and step out) and Run to Cursor command to navigate code in the debugger.

  • Step Into

    When the debugger pauses at the animal.Feed method call in the Main method, press F11 (or select Debug > Step Into) to advance into code for the Dog class.

    F11 is the Step Into command. It advances the app execution one statement each time and serves to examine the execution flow in the most detail. By default, the debugger skips over non-user code.

  • Step Over

    When the debugger advances to the Feed method in the Dog class, press F10 (or select Debug > Step Over) several times until the debugger stops on the base.Feed method call, and then press F10 one more time.

    The debugger does not step into the Feed method of the base class. F10 steps over the methods or functions in your app code, but the block of code is still executed. By pressing F10, rather than F11, on the base.Feed method call, we skip over the implementation code for base.Feed.

  • Step Out

    When you have examined the Feed method in the Dog class, press Shift + F11 (or select Debug > Step Out) to get out of the method but stay in the debugger.

    The Step Out command resumes app execution and advances the debugger until the current function returns.

    You will be back in the foreach loop in the Main method.

  • Run to Cursor

    While the program is in debug mode, right-click a line of code in your app and select Run to Cursor. This command sets a temporary breakpoint at the current line of code. If breakpoints have already been set, the debugger pauses at the first breakpoint that it hits. You can use this command when you need to quickly set a temporary breakpoint.

Checking variables with Data Tips and Locals window

Variables can be checked via data tips and Locals window.

Checking variables with Data Tips

Usually, when you are debugging an issue, you try to figure out whether variables are storing the desired values. The data tips are a good way to do it.

  1. When you pause on the animal.Feed() method, hover over the animal object and you see its default property value, which is Dog.

  2. Expand the animal object to see its properties, such as the Weight property, which has a value of 0.

  3. Press F10 (or select Debug > Step Over) several times to iterate once through the foreach loop until the debugger pauses again on the animal.Feed() method.

  4. Hover over the animal object again, and this time you have a new object type Cat.

Checking variables with the Locals window

The Locals window displays the variables that are in the current execution context.

  1. When the debugger pauses in the foreach loop, click the Locals window, which is by default open in the lower left pane of the code editor.

    If it is closed, open it by selecting Debug > Windows > Locals from the top menu bar.

  2. Press F11 to advance the debugger so that you can check the variables in the execution contexts.

Adding a Watch

In the code editor window, right-click the animal object and select Add Watch.

The Watch window opens at the bottom left corner of the code editor. You can use a Watch window to specify an expression or a variable you want to monitor.

After you have set a watch on the animal object, you can see its value change as you run through the debugger. Unlike the other variable windows, the Watch window always displays the variables you are monitoring. They're grayed out when out of scope and an error is reported.

Checking the Call Stack

The Call Stack window displays the order in which functions or methods are called. It can be used to examine and understand the execution flow of a program.

  1. When the debugger pauses in the foreach loop, click the Call Stack window, which is by default open in the lower right pane.

    If it is closed, open it while paused in the debugger by selecting Debug > Windows > Call Stack.

  2. Click F11 several times until you see the debugger pause in the base.Feed method for the Dog class in the code editor. Look at the Call Stack window.

    The first line displays the current function (the Dog.Feed method in this app). The second line shows that Dog.Feed is called from the Main method.

Compiling and Building

Project files must be compiled and built before they can be used to generate an application to be deployed to the users. Before you compile and build a project or solution, you need to configure the various project properties and solution properties so that you can build your project or solution in desired ways.

Configuring project properties

This section describes how you can configure the various project properties, including properties related to application, build, build events, package, debug and signing, so that you can build your projects in ways that best fit your needs. To configure the Project Properties settings, right-click a project node in Solution Explorer, and then select Properties so that the project designer pops up.

Application

The Application settings allow you to specify the various application configurations, such as assembly name, target framework, output type, and ways of resources management. To access these settings, click the Application tab in the project designer.

The following settings allow you to specify some basic configurations for the application, including the assembly name, default namespace, target framework, output type, as well as the entry point when you start an application.

  • Assembly name

    Designates the name of the output files that contain the assembly metadata. If it is changed here, the output assembly name will be changed too.

  • Default namespace

    Specifies the base namespace for files newly added to the project.

  • Target framework

    Defines the .NET version that your application targets. The dropdown list can have different values depending on the .NET versions that are installed on your current machine. If your project targets .NET Core, you can choose any of the following .NET Core versions.

  • Output type

    Specifies the type of application to build. The output type varies depending on the type of project you create. For a Web application project, for example, you must select Console Application as the output type. For a Console App project, you must select Console Application.

  • Startup

    Designates the entry point to be called when you start an application. The entry point is usually set either to the main form in your program or to the Main procedure that runs when you start the application. If your compilation has multiple types that contain a Main method, you can specify which type contains the Main method that you want to use as the entry point into the application. This property for class libraries defaults to (Not set) because they don’t have an entry point.

  • Resources

    The Resources settings allow you to specify how resources of your application will be managed.

  • Icon and manifest

    The Icon and Manifest option is enabled by default. These settings allow you to select your own icon, or to select different manifest generation options. In most cases, you can rely on this radio button to manage your application resources. If you want to provide a resource file for the project, select the Resource file radio button instead.

  • Icon

    Designates the .ico file that you want to use as the icon for your application. Enter the name of the .ico file, or click Browse to select an existing icon. Note that this feature is available only for .NET Framework apps created outside SnapDevelop.

  • Manifest

    Selects a manifest generation option when the application runs on Windows Vista under User Account Control (UAC). This option can have the following values:

    • Embed manifest with default settings. This is the default option. It embeds security information into the executable file of the application, specifying that requestedExecutionLevel be AsInvoker.

    • Create application without a manifest. This method is known as virtualization. Use this option for compatibility with earlier applications.

  • Resource file

    Select this radio button when you want to provide a resource file for the project. Enter a path name of a resource file or click Browse to add a Win32 resource file to the project.

Build

The Build settings allow you to configure the various build properties, such as conditional compilation symbols, target platform, warning and error treatment, as well as output management. To access these settings, click the Build tab in the project designer.

  • Configuration and platform

    SnapDevelop currently supports two ways of build: Debug and Release, and the platform on which an application runs is set to Any CPU by default. Therefore, you can choose to perform the Debug configuration on any CPU or the Release configuration on any CPU. However, the Debug and Release options cannot be selected at the same time. The Configuration and Platform options make it possible for you to select the specific configuration and platform you want to display or modify.

    Configuration

    Specifies the configuration settings (Debug or Release) you want to display or modify.

    Platform

    By default, the platform is set to Any CPU, which means that you can build and deploy your application on any development platform.

  • Conditional compilation symbols

    Designates one or more symbols to perform conditional compilation. Use a semi-colon or comma to separate symbols if you specify multiple symbols here. If you designate a conditional compilation symbol here, you can use the symbol to compile your project-wide source files conditionally without having to define such a symbol in individual files.

    The -define option defines names as symbols in all source code files in your program. The -define option is equivalent to a #define preprocess directive except that this option is applicable for all files in your project. A symbol specified here remains defined unless otherwise undefined using an #undef directive. If you use the -define option, an #undef directive in one file has no project-wide effect.

    You can use symbols created by this option with #if, #else, #elif, and #endif to perform conditional compilation for the source files in your project.

    For example, if you have created a Console App using SnapDevelop and you enter ABC; HelloWorld in the Conditional compilation symbols box,

    you can set the project compilation conditions in the .cs file in Solution Explorer.

    If you run the application, you will get the following output.

    If you un-define ABC using an #undef directive and then run your application again,

    you will get the following output:

  • Define DEBUG constant

    Select this option to treat DEBUG as a constant symbol in all source code files in your project. Enabling this option has the same effect as entering DEBUG in the Conditional compilation symbols box.

  • Define TRACE constant

    Select this option to treat TRACE as a constant symbol in all source code files in your project. Enabling this option has the same effect as entering TRACE in the Conditional compilation symbols box.

  • Platform target

    Designates the processor on which the output file is to run. Select Any CPU if you want your output file to run on any processor, select x86 if you want it to run on any 32-bit Intel-compatible processor, or select x64 if you want it to run on any 64-bit Intel-compatible processor.

  • Prefer 32-bit

    If you enable this option, your application runs as a 32-bit application on both 32-bit and 64-bit Windows operating systems. If you disable this option, your application runs as a 32-bit application on 32-bit Windows operating systems and as a 64-bit application on 64-bit Windows operating systems. Note that the Prefer32-bit option is available only if the Platform target list is set to Any CPU.

    If you run an application as a 64-bit application, the pointer size doubles, and incompatibility may occur with other libraries that are exclusively 32-bit. Run a 64-bit application only if the application requires over 4 GB of memory or 64-bit instructions significantly improve performance.

  • Allow unsafe code

    Allows code that uses the unsafe keyword to compile. By default, C# does not support pointer arithmetic in order to ensure type security. However, you can use the unsafe keyword to define an unsafe context in which pointers can be used. Unsafe code has the following properties:

    • Unsafe code can be types, methods, or code blocks.
    • Unsafe code may improve an application’s performance by removing array bounds checks.
    • Unsafe code must be compiled with the unsafe compiler option.
    • Unsafe code causes security problems.
    • Unsafe code is necessary when you call native functions that require pointers.
  • Optimize code

    If you enable this option, the C# compiler optimizes your code by making your output files smaller, faster, and more efficient.

  • Errors and warnings

    The following settings configure the error and warning options when you are building your project.

    Warning level

    Specifies the warning level for the compiler to display. The warning levels range from 0 to 4. Higher warning levels show more warnings while lower warning levels show more serious warnings. The following table illustrates the meanings of individual warning levels.

    Warning LevelDescription
    0Does not show any warning messages.
    1Shows serious warning messages.
    2Shows level 1 warnings and less serious warnings.
    3Shows level 2 warnings and less serious warnings.
    4Shows all level 3 warnings plus informational warnings.
  • Suppress warnings

    Blocks the generation of one or more warnings. Use semi-colon or comma to separate warning numbers if there is more than one warning.

  • Treat warnings as errors

    The following settings allow you to determine which warnings are treated as errors.

    None

    Treats no warnings as errors.

    All

    Treats all warnings as errors.

    Specific warnings

    Treats specific warnings as errors. Use a semi-colon or comma to separate warning numbers if you want to specify multiple warnings as errors.

  • Output

    The following settings allow you to specify the output configuration for the build process.

  • Output path

    Designates the path of the output files. Select Browse to specify a path, or directly enter a path in this box. If you don’t specify a path, the compiled files will be output into the default path, which is bin\Debug or bin\Release\.

  • XML documentation file

    Designates the name of a file which contains documentation comments. If you enable this option and then build your project, you will see a .xml file in Solution Explorer.

  • Register for COM Interop

    Specifies that your managed application will generate a COM callable wrapper that allows a COM object to interact with your managed application. COM is a language-neutral way of implementing objects that can be used in environments other than the one in which they are created, even across machine boundaries. It offers a stable application binary interface that does not change between compiler releases.

    Note that your application should be a .NET Framework application and the Output type in the Application page of the project designer for this application must be Class Library so that the Register for COM interop option is available.

  • Advanced build settings

    The Advanced Build Settings dialog box allows you to specify advanced build configurations, including the version of a programming language, the way compiler errors are reported, debugging information, file alignment, as well as library base address.

    Language version

    Designates the version of the programming language to use. Each version has its own specific features. This option makes it possible for you to force the compiler to enable some of the implemented features, or to allow only the features that are compatible with an existing standard. The following table displays the various language versions that are currently available in the SnapDevelop compiler.

    Language VersionMeaning
    C# latest major version (default)The compiler recognizes all valid language syntax from the latest major version that it can support.
    C# latest minor version (latest)The compiler recognizes all valid language syntax from the latest minor version that it can support.
    ISO-1The compiler only recognizes syntax included in ISO/IEC 23270:2003 C# (1.0/1.2).
    ISO-2The compiler only recognizes syntax included in ISO/IEC 23270:2006 C# (2.0).
    C# 3The compiler only recognizes syntax included in C# 3.0 or earlier versions.
    C# 4The compiler only recognizes syntax included in C# 4.0 or earlier versions.
    C# 5The compiler only recognizes syntax included in C# 5.0 or earlier versions.
    C# 6The compiler only recognizes syntax included in C# 6.0 or earlier versions.
    C# 7The compiler only recognizes syntax included in C# 7 or earlier versions.
    C# 7.0The compiler only recognizes syntax included in C# 7.0 or earlier versions.
    C# 7.1The compiler only recognizes syntax included in C# 7.1 or earlier versions.
    C# 7.2The compiler only recognizes syntax included in C# 7.2 or earlier versions.
    C# 7.3The compiler only recognizes syntax included in C# 7.3 or earlier versions.
  • Internal compiler error reporting

    Specifies whether to report internal compiler errors. The prompt is selected by default, which means that you will receive a prompt if any compiler error occurs. If you select none, the error will be reported only in the output of the text compiler. If you select send, an error report will be sent automatically. If you select queue, error reports will be queued.

  • Check for arithmetic overflow/underflow

    Specifies whether runtime exceptions occur if an integer arithmetic statement exceeds the scope of the checked or unchecked keywords and leads to a value that exceeds the range of the data type.

  • Debugging information

    Determines the type of debugging information that is generated by the compiler. The following table displays the various types of debugging information and their respective meanings.

    TypeDescription
    FullAttaches a debugger to the running program.
    NoneDoes not generate debugging information.
    PdbOnlyAllows debugging of the source code with the program launched in the debugger but displays only assembler with the running program attached to the debugger.
    PortableGenerates a .PDB file, a symbol file which is portable and not platform-specific. This file contains information about what is in the main executable file and how it was generated.
    EmbeddedInserts portable symbol information into the assembly.
  • File alignment

    Determines the size of the output file. You can select any value, measured in bytes, from the dropdown list, which includes 512, 1024, 2048, 4096, and 8192. The size of the output file is determined by aligning a section on a boundary that is a multiple of this value.

  • Library base address

    Designates the preferred base address where a DLL can be loaded. The default base address for a DLL is specified by the .NET Framework common language runtime.

Build events

The Build Events settings allow you to specify build configuration instructions and specify the conditions for the running of post-build events. To access these settings, click the Build Events tab in the project designer.

  • Pre-build event command line

    Allows you to write commands to execute before the build starts. If you want to write long commands, you can enter your commands in the Pre-build Event Command Line input box that pops up when you click Edit Pre-build.

    The command line input boxes allow you to insert a variety of macros, which are case-insensitive, and which can be used to designate locations for files or to get the actual name of the input file.

    Appendix B: List of Pre-build and Post-build Macros lists and explains the macros that you can add in the command line.

  • Post-build event command line

    Allows you to write commands to execute after the build finishes. If you want to write long commands, you can enter your commands in the Post-build Event Command Line input box that pops up when you click Edit Post-build.

    The command line input boxes allow you to insert a variety of macros, which are case-insensitive, and which can be used to designate locations for files or to get the actual name of the input file.

    Appendix B: List of Pre-build and Post-build Macros lists and explains the macros that you can add in the command line.

  • Run the post-build event

    Specifies the conditions for the running of the post-build events. The following table lists the various conditions and the results of applying these conditions.

    OptionResult
    AlwaysPost-build events will run regardless of the condition.
    On successful buildPost-build events will run if a project is successfully built.
    When the build updates the project outputPost-build events will run only if the compiler's output files (.exe files or .dll files) differ from the previously compiled files.

Package

The Package settings allow you to configure the various package properties, such as package generation, package ID, package version, package author, output path, as well as all details about the package. To access these settings, click the Package tab in the project designer.

  • Require license acceptance

    If you enable this option, you will be asked whether to accept the package license before you install a particular package.

  • Generate NuGet package on build

    If you enable this option, you can use SnapDevelop to automatically generate the NuGet package when you build the project. Note that your project must be a Class Library project and that you can meaningfully configure the various package properties only if the Generate NuGet Package on Build option is enabled.

  • Packaging options

    The following table lists the variety of package properties and the meanings of individual package properties.

    PropertyDescription
    Package IDA unique and case-insensitive package identifier. IDs generally follow the .NET namespace naming conventions and do not allow spaces or characters, which are invalid for a URL.
    Package versionThe version of the package.
    AuthorsThe author(s) of a package. Use comma to separate authors if the package is created by a group of authors.
    CompanyThe creator(s) of a package. Use comma to separate creators if there are several creators.
    ProductThe name of the product.
    DescriptionA general description of the package.
    CopyrightCopyright details for the package.
    License URLPath to the license file.
    Project URLURL for the package's home page.
    Icon URLURL for an image used as the icon of the package.
    Repository URLURL for the repository.
    Repository typeThe type of the currently used repository.
    TagsKeywords that represent the characteristics of a package and that may help you find the particular package on nuget.org.
    Release notesA description of the changes made in the current release package.
    Assembly versionEach assembly has a unique version number that represents its identity and this version number consists of four parts: <major version>.<minor version>.<build number>.<revision>.
    Assembly file versionA version number given to file as in file system.

Debug

The Debug settings allow you to specify how the SnapDevelop debugger behaves in a C# project. To access these settings, click the Debug tab in the project designer.

The following table lists the debug options you can configure for your application and explains the meaning of each option.

OptionDescription
ProfileDisplays the currently active project. You can click Create to add a new project for which you want to configure the start options. Or you can click Delete to remove a project from the dropdown list.
LaunchSpecifies the launch action when you select Start from the Debug menu. If you select Project, which is the default option, the debugger launches the startup project for debugging. If you select Executable, the debugger launches and attaches to an executable (for Windows/Console Application projects) outside SnapDevelop when you debug the application. If you select the Executable option, you will be asked to provide a path to the executable to run in the Execute file input box that follows immediately on the next line.
Application argumentsSpecifies command line arguments for the application being debugged.
Working directorySpecifies the working directory of the application being debugged. By default, the working directory for C# applications is \bin\debug.
Launch browserSpecifies that a particular URL should be accessed when you debug a Web application.
Environment variables.NET Core reads environment variables stored in the launchSetting.json file when you launch an application. You can set the environment to any value, but .NET Core supports three common values: Development, Staging, and Production.
Development: The Development environment can enable features that should not be enabled in Production environment.
Staging: The Staging environment is used primarily to test all the installation/configuration/migration scripts and procedures before they are applied to a Production environment. In addition, staging is used to run performance test, particularly load test, since this is often sensitive to the environment.
Production: The Production environment should be selected to maximize security, performance, and application robustness. Production environment differs from the Development environment in a variety of ways: caching; client-side resources are bundled, minified, and potentially served from a CDN; diagnostic error pages disabled; friendly error pages enabled; production logging and monitoring enabled. Note that if the environment isn’t set, it defaults to Production.
App URLDesignates the location of the Web application you want to debug. Use semi-comma to separate URLs if there is more than one URL. There are two default URLs (https://localhost:5001 and http://localhost:5000).

Signing

The Signing settings allow you to sign the application and deployment manifests and also to sign the strong named assembly. To access these settings, click the Signing tab in the project designer.

  • Sign the assembly

    You can enable this check box to sign the assembly and create a strong name key file. Enabling this option allows you to sign the assembly using the Al.exe tool supported by the Windows Software Development Kit (SDK).

  • Choose a strong name key file

    You can specify a new or existing strong name key file that can be used to sign the assembly. Select New to create a new key file or Browse to choose an existing one. If you select New, the Create Strong Name Key dialog box pops up, which allows you to designate a key file name and protect the key file with a password. The password must be at least six characters in length. If you specify a password, a Personal Information Exchange (.pfx) file is created. If you don’t specify a password, a Strong Name Key (.snk) file is created. The two types of files are briefly introduced in the following table.

    If you build a project with one of the key files created, the created file will be used to sign the assembly.

    File typeDescription
    .pfx fileContains certificate and its public and private keys. It is used for code signing and serves to prevent malicious tampering with assemblies distributed publicly.
    .snk fileContains the strong key. It is used for strong-naming, which uses a key pair to uniquely identify an assembly.
  • Delay sign only

    You can enable this check box to delay assembly signing. If you enable this option, your project cannot be debugged and will not run. However, you can use the strong name tool (Sn.exe) with the -Vr option to skip verification during development.

You can take the following steps to sign an assembly:

  1. Enable the Sign the assembly option.

  2. Create a strong name key file and specify a password (a .pfx file is created in Solution Explorer).

  3. Build the project.

You can view the components (for example, .dll files) in the compiled project files to check if an assembly is signed.

This image indicates that an assembly is signed.

This image indicates that an assembly is not signed (probably because the Sign the assembly option is not enabled).

If you enable the Delay sign only option, you will obtain the public key but the assembly is currently not signed.

Configuring solution properties

A solution configuration specifies how projects in the solution are to be built and deployed. To configure the Solution Properties, right-click your solution node in Solution Explorer, and then select Properties so that the Solution Properties dialog box pops up.

Startup project

The Startup Project options allow you to specify which project to run when you launch the SnapDevelop debugger. To configure the Startup Project settings, expand the Common Properties node, and then select Startup Project.

  • Current selection

    Enable this option if you want the current project to run when you launch the SnapDevelop debugger.

  • Single startup project

    Enable this option if you want any project to run when you launch the SnapDevelop debugger.

Project dependencies

When you build a solution, you need to build some projects first in order to generate executable code that can then be used by the other projects. The Project Dependencies settings allow you to determine the desired build order for projects in your solution. To configure the Project Dependencies settings, expand the Common Properties node, and then select Project Dependencies.

  • Projects

    The dropdown list has all projects in your solution. You can select any project that uses executable code generated by another project or other projects.

  • Depends on

    You can select any project that generates executable code used by the project you selected in the Projects dropdown list.

    Note that circular dependency is not allowed. For example, if project A depends on project B, which in turn depends on project C, then project C cannot depend on project A or project B and project B cannot depend on project A.

    Please also note that the projects selected on the Depends on pane may not be actually built. Whether the projects are built or not depends on the selection of the check boxes for the projects in the active solution build configuration.

Configuration properties

The Configuration Properties settings allow you to manage the various properties for the entire solution. You can decide whether to build or deploy a particular project, and what configuration of a particular project to build or deploy on what development platform. To configure the Configuration Properties settings, expand the Configuration Properties node, and then select Configuration.

Configuration manager

You can select Configuration Manager to open the Configuration Manager dialog box, which allows you to create and specify configurations and platforms at both the solution level and the project level.

Active solution configuration

Specifies what configuration is built at the solution level when you select Build Solution on the Build menu. You can select one of the two default configurations - Debug and Release, or you can add new ones. If you realize that an existing configuration name is not appropriate, you can rename it. If you do not need a particular configuration anymore, you can remove it from the Active Solution Configuration box. This will remove all solution and project configurations you specified for that combination of configuration and platform.

To add a new configuration, you need to:

  1. Select <New> from the Active Solution Configuration box.

  2. Enter a name for the new configuration on the New Solution Configuration window.

  3. Select a configuration from the Copy settings from box if you want to use the settings from an existing solution configuration or select <Empty> otherwise.

  4. Select the Create new project configurations check box if you want to create project configurations simultaneously.

To rename a solution configuration, you need to:

  1. Select <Edit> from the Active Solution Configuration box.

  2. Select the configuration you want to modify on the Edit Solution Configurations window.

  3. Select Rename and then enter a new name.

To remove a solution configuration, you need to:

  1. Select <Edit> from the Active Solution Configuration box.

  2. Select the configuration you want to remove on the Edit Solution Configurations window.

  3. Select Remove.

Active solution platform

Specifies the solution-level development platform you want your solution to target. The development platform defaults to Any CPU, but you can also create new platforms. If you realize that an existing platform name is not appropriate, you can rename it. If you do not need a particular platform anymore, you can remove it from the Active Solution Platform box. This will remove all solution and project configurations you specified for that combination of configuration and platform.

To create a new solution platform, you need to:

  1. Select <New> from the Active Solution Platform box.

  2. Select a new platform (x64 or x86) from the Type or select the new platform box.

  3. Select a platform from the Copy settings from box if you want to use the settings from an existing solution platform or select <Empty> otherwise.

  4. Select the Create new project configurations check box if you want to create project platforms simultaneously.

To rename a solution platform, you need to:

  1. Select <Edit> from the Active Solution Platform box.

  2. Select the platform you want to modify on the Edit Solution Platforms window.

  3. Select Rename and then enter a new name.

To remove a solution platform, you need to:

  1. Select <Edit> from the Active Solution Platform box.

  2. Select the platform you want to remove on the Edit Solution Configurations window.

  3. Select Remove.

Project contexts

Although the combination of configuration and development platform has been specified at the solution level when you specify active solution configuration and active solution platform, Project Contexts allows you to finally decide whether to build a particular project, and what configuration of the project to build or deploy on what development platform. The following table lists the various project contexts and their respective meanings.

ItemDescription
ProjectLists all projects in your solution.
ConfigurationLists the type of build currently active for each project. You can select Debug, Release, or any custom configuration from the dropdown list. You can perform the same operations as you set the active solution configuration. But the configurations you specify here are applicable project-wide only.
PlatformSelects the development platform you want your project to target. You can perform the same operations as you set the active solution platform. But the platform you select here applies project-wide only.
BuildSpecifies whether to include a particular project when you build the solution. The check boxes for all projects are selected by default, but you can uncheck the box(s) for the project(s) you don’t want to build.
DeployWhen available, check the box to include a particular project when the solution is to be deployed.
Configuration

Displays the results of your setting of the Active Solution Configuration in Configuration Manager.

Platform

Displays the results of your configuration of the Active Solution Platform in Configuration Manager.

Project contexts

Displays the results of your configuration of the project contexts in Configuration Manager. Note that the configurations specified in Configuration Manager can be modified here. The modifications made here are equivalent to those made in Configuration Manager. If you have modified the project contexts properly, you need to click Apply to validate such modifications.

Building, rebuilding, or cleaning projects and solutions

After you have configured the project properties and solution properties, you can then build, rebuild, or clean the projects and solutions.

Building, rebuilding, or cleaning a single project

You can take the following steps to build, rebuild, or clean a single project.

  1. Select the node of a project you want to build/rebuild/clean in Solution Explorer.

  2. Select Build on the menu bar, and then select one of the following options:

    OptionDescription
    Build ProjectNameCompiles only the project files that have changed since the project was most recently built.
    Rebuild ProjectNameCleans the project and then builds all project files.
    Clean ProjectNameRemoves all compiled project files (such as .dll files and .exe files).

Building, rebuilding, or cleaning an entire solution

You can take the following steps to build, rebuild, or clean an entire solution.

  1. Select the solution node in Solution Explorer.

  2. Select Build on the menu bar, and then select one of the following options:

    OptionDescription
    Build SolutionCompiles only the solution files that have changed since the solution was most recently built.
    Rebuild SolutionCleans the solution and then builds all solution files.
    Clean SolutionRemoves all compiled solution files (such as .dll files and .exe files).

Publishing and Hosting Apps Developed in SnapDevelop

An independent tutorial on how to publish a project in SnapDevelop is available on the following link: https://docs.appeon.com/appeon_online_help/snapdevelop2019r2/Publish/index.html

Appendix A: Keyboard Shortcuts for SnapDevelop

The following table lists all keyboard shortcuts for SnapDevelop functionalities.

GroupFunctionalityKeyboard Shortcut
MenuFile

New ProjectCtrl+F5

Open Project/SolutionCtrl+Shift+O

Open FileCtrl+O

CloseCtrl+F4

SaveCtrl+S

Save AllCtrl+Shift+S

ExitAlt+F4

Edit

Find in FilesCtrl+Shift+F

Replace in FilesCtrl+Shift+H

UndoCtrl+Z

RedoCtrl+Y

CutCtrl+X

CopyCtrl+C

PasteCtrl+V

Select AllCtrl+A

Format DocumentCtrl+K, Ctrl+D

Format SelectionCtrl+K, Ctrl+J

Make UppercaseCtrl+Shift+U

Make LowercaseCtrl+U

Comment SelectionCtrl+K, Ctrl+B

Uncomment SelectionCtrl+K, Ctrl+E

Toggle Outlining ExpansionCtrl+M, Ctrl+M

Toggle All outliningCtrl+M, Ctrl+L

Stop OutliningCtrl+M, Ctrl+P

Stop Hiding CurrentCtrl+M, Ctrl+H

Collapse to DefinitionsCtrl+M, Ctrl+O

CodeAssistCtrl+K, Ctrl+G

RenameCtrl+R, Ctrl+R

Retract MethodCtrl+R, Ctrl+M

Extract InterfaceCtrl+R, Ctrl+I

View

Solution ExplorerCtrl+Alt+L

Error ListCtrl+\, Ctrl+E

OutputCtrl+Alt+O

Find ResultsCtrl+Alt+F

Project

Add New ItemCtrl+Shift+A

Add Existing ItemShift+Alt+A

PropertiesAlt+Enter

Build

Build SolutionF6

Build SelectionShift+F6

Debug

Stop DebuggingShift+F5

WatchCtrl+Alt+W

LocalsCtrl+Alt+V

Call StackCtrl+Alt+C

ThreadsCtrl+Alt+H

BreakpointsCtrl+Alt+B

Exception SettingsCtrl+Alt+E

Break AllCtrl+Alt+Break

Start Without DebuggingCtrl+F5

Attach to ProcessCtrl+Alt+P

Step IntoF11

Step OverF10

Step OutShift+F11

Toggle BreakpointF9
ToolbarStandard Toolbar Options

Navigate BackwardCtrl+-

Navigate ForwardCtrl+Shift+-

New ProjectCtrl+Shift+N

Open FileCtrl+O

Save AppeonDataContext.csCtrl+S

Save AllCtrl+Shift+S

CutCtrl+X

CopyCtrl+C

PasteCtrl+V

UndoCtrl+Z

RedoCtrl+Y

Start DebuggingF5

Start Without DebuggingCtrl+F5

Build Toolbar Options

BuildShift+F6

Build SolutionF6

CancelCtrl+Break

Debugger Toolbar Options

Stop DebuggingShift+F5

Break AllClt+Alt+Break

Step IntoF11

Step OverF10

Step OutShit+F11

Text Editor Toolbar Options

Display Quick InfoCtrl+K, Ctrl+G

Comment out the selected linesCtrl+K, Ctrl+B

Uncomment the selected linesCtrl+K, Ctrl+E

Make UppercaseCtrl+Shift+U

Make LowercaseCtrl+U
Solution ExplorerSolution’s Right-Click Menu

Search Solution ExplorerCtrl+;

Build SolutionF6

PasteCtrl+V

RenameF2

PropertiesAlt+Enter

Project’s Right-Click Menu

BuildShift+F6

CutCtrl+X

PasteCtrl+V

RemoveCtrl+D

RenameF2

PropertiesAlt+Enter

Add New ItemCtrl+Shift+A

Add Existing ItemShift+Alt+A

DeleteDel
Code Editor.cs File’s Right-Click Menu

RenameCtrl+R, Ctrl+R

Go To DefinitionF12

Go To ImplementationCtrl+F12

Find All ReferencesShift+F12

CutCtrl+X

CopyCtrl+C

PasteCtrl+V

Toggle Outlining ExpansionCtrl+M, Ctrl+M

Toggle All outliningCtrl+M, Ctrl+M

Stop OutliningCtrl+M, Ctrl+P

Stop Hiding CurrentCtrl+M, Ctrl+H

Collapse to DefinitionsCtrl+M, Ctrl+O

.js File’s Right-click Menu

CutCtrl+X

CopyCtrl+C

PasteCtrl+V
OutputRight-Click Menu

CopyCtrl+C

Go To Next LocationF8

Go To Previous LocationShift+F8
Error ListRight-Click Menu

CopyCtrl+C

Next ErrorCtrl+Shift+F12
Find And ReplaceFind And Replace

Find in FilesCtrl+Shift+F

Replace in FilesCtrl+Shift+H

Quick FindCtrl+F

Find NextF3

Find PreviousShift+F3

Quick ReplaceCtrl+H
DebugToolbar’s Debug

WatchCtrl+Alt+W

LocalsCtrl+Alt+V

Call StackCtrl+Alt+C

ThreadsCtrl+Alt+H

BreakpointsCtrl+Alt+B

Exception SettingsCtrl+Alt+E

Locals

CopyCtrl+C

Watch

CopyCtrl+C

DeleteDel

Call Stack

CopyCtrl+C

Appendix B: List of Pre-build and Post-build Macros

The following table lists the macros and illustrates the meanings of individual macros.

MacroMeaning
OutDirPath to the output file directory, relative to the project directory.
ConfigurationNameThe name of the current project configuration.
PlatformNameThe name of the target platform.
TargetNameThe base name of the primary output file for the build.
TargetExtThe file extension of the primary output file for the build.
TargetFileNameThe file name of the primary output file for the build (defined as base name and file extension).
TargetPathThe absolute path name of the primary output file for the build (defined with drive, path, base name, and file extension).
TargetDirThe directory of the primary output file for the build (defined with drive and path).
ProjectPathThe absolute path name of the project (defined with drive, path, base name, and file extension).
ProjectExtThe file extension of the project.
ProjectDirThe directory of the project (defined with drive and path).
ProjectFileNameThe file name of the project (defined with base name and file extension).
ProjectNameThe base name of the project.
ConfigurationThe name of the current project configuration.
PlatformThe name of the currently targeted platform.
SolutionFileNameThe file name of the solution (defined with base name and file extension).
SolutionPathThe absolute path name of the solution (defined with drive, path, base name, and file extension).
SolutionDirThe directory of the solution (defined with drive and path).
SolutionNameThe base name of the solution.
SolutionExtThe file extension of the solution.

Appendix C: Regular Expression Examples

The following table contains some regular expression characters, operators, constructs, and pattern examples.

ExpressionDescriptionExample
.Matches any single character (except a line break).a.o matches "aro" in "around" and "abo" in "about" but not "acro" in "across".
*Matches zero or more occurrences of the preceding expression (match as many characters as possible).a*r matches "r" in "rack", "ar" in "ark", and "aar" in "aardvark".
.*Matches any character zero or more times.c.*e matches "cke" in "racket", "comme" in "comment", and "code" in "code".
+Matches one or more occurrences of the preceding expression (match as many characters as possible).e+d matches "eed" in "feeder" and "ed" in "faded".
.+Matches any character one or more times.e.+e matches "eede" in "feeder" but finds no matches in "feed".
*?Matches zero or more occurrences of the preceding expression (match as few characters as possible).\w*?d matches "fad" and "ed" in "faded" but not the entire word "faded" due to the lazy match.
+?Matches one or more occurrences of the preceding expression (match as few characters as possible).e\w+? matches "ee" in "asleep" and "ed" in "faded" but finds no matches in "fade".
\^Anchors the match string to the beginning of a line or string.\^car matches the word "car" only when it appears at the beginning of a line.
\r?$Anchors the match string to the end of a line.car\r?$ matches "car" only when it appears at the end of a line.
$Anchors the match string to the end of the file.car$ matches "car" only when it appears at the end of the file.
[abc]Matches any single character in a set.b[abc] matches "ba", "bb", and "bc".
[a-f]Matches any character in a range of characters.be[n-t] matches "bet" in "between", "ben" in "beneath", and "bes" in "beside", but finds no matches in "below".
()Captures and implicitly numbers the expression contained within parenthesis.([a-z])X\1 matches "aXa"and "bXb", but not "aXb". "\1" refers to the first expression group "[a-z]".
(?!abc)Invalidates a match.real(?!ity) matches "real" in "realty" and "really" but not in "reality." It also finds the second "real" (but not the first "real") in "realityreal".
[\^abc]Matches any character that is not in a given set of characters.be[\^n-t] matches "bef" in "before", "beh" in "behind", and "bel" in "below", but finds no matches in "beneath".
|Matches either the expression before or the one after the symbol.(sponge|mud) bath matches "sponge bath" and "mud bath".
\Escapes the character following the backslash.\\^ matches the character \^.
{n}, where 'n' is the number of occurrencesSpecifies the number of occurrences of the preceding character or group.x(ab){2}x matches "xababx". x(ab){2,3}x matches "xababx" and "xabababx" but not "xababababx".
\p{X}, where "X" is the Unicode number.Matches text in a Unicode category.\p{Lu} matches "T" and "D" in "Thomas Doe".
\b (Outside a character class \b specifies a word boundary, and inside a character class \b specifies a backspace.)Matches a word boundary.\bin matches "in" in "inside" but finds no matches in "pinto".
\r?\nMatches a line break (that is, a carriage return followed by a new line).End\r?\nBegin matches "End" and "Begin" only when "End" is the last string in a line and "Begin" is the first string in the next line.
\wMatches any word character.a\wd matches "add" and "a1d" but not "a d".
\sMatches any whitespace character.Public\sInterface matches the phrase "Public Interface".
\dMatches any decimal digit character.\d matches "4" and "0" in "wd40".