You can build and test XML Notepad using Visual Studio 2022. It uses .NET frameworks, so be sure to install the ".NET desktop development" feature when using the Visual Studio Installer. XML Notepad targets .NET Framework version 4.7.2 which is the default target for VS 2022.
XmlNotepad follows the standard C# Coding Guidelines with the default C# formatting settings that ship with VS 2022.
The following additional conventions are also followed:
- All if/else statements use curly brackets.
- Add private/internal/public access explicitly on all members.
- Do not use "s_" prefix on statics, instead use Class name qualification.
- All private fields prefixed with
_except for WinForms generated code.
- Accessing fields with
this.is ok, do not strip
this.prefix if used.
- Constants are PascalCased even if they are private to a class.
- Try and collect all private fields at the top of the class.
- Public fields are PascalCased like public properties and methods.
- Generally one class per file, unless there is a super natural family of classes, like Commands.cs, that would cause an unnecessary explosion in number of files.
- Nice to have blank line between methods.
- Use "Remove and Sort Usings" command in VS.
Build the code#
First clone the repo:
git clone https://github.com/microsoft/XmlNotepad.git
src/XmlNotepad.slninto Visual Studio.
- Select Debug or Release and target "Any CPU".
- Run Build Solution.
Debug the app#
- Right click the
Applicationproject and select
Set as Startup Project.
- Select Debug configuration.
- Press F5 to start debugging.
Test the app#
After building the app:
- Right click the
UnitTestsproject and select
This is a GUI test, so do not move your mouse or type on your keyboard or let your screen lock until this test is completed. Total test run time is about 12 minutes.
The tests all pass on Windows 10, but currently some tests fail on Windows 11, there seems to be some breaking changes in the Windows Automation layer that XML notepad tests are using. This is being investigated.
BuildTasks project contains special MSBuild task that is used to synchronize the
across multiple places so you can edit the version number there be sure to update both the
ApplicationVersion so that the final number in the
ApplicationVersion matches the
Then when you do a build the following will be updated automatically:
Version.csfile which sets the assembly version for all projects in the solution.
- The WIX based setup file
- The windows package manifest file
- The updates.xml file.
- The readme.htm file.
You will also have to restart Visual Studio so that the new versions are picked up by the ClickOnce
deployment information in
Note: if you change the
SyncVersions.cs code, and build a new DLL you will need to close VS, and copy the
BuildTasks\XmlNotepadBuildTasks.dll, then reload the
XmlNotepad.sln. This is done this way because Visual Studio will lock this file after doing a build, so you wouldn't be
able to compile the new version.
Publish the ClickOnce installer#
Application project properties and you will see a Publish option there. This will place
the publish bits in a folder named
d:\git\lovettchris\XmlNotepad\publish\ you can change this on
the Project properties. It is recommended you use strongly signed bits. The signing certificate is
specified using environment variable
MYKEYFILE, but you can build, debug and test XML Notepad
without this environment variable set.
This setup provides the ClickOnce installed version of XML Notepad installable from lovettsoftware. This is the most convenient installer since it is a single click and also provide auto-updating whenever a new version is published.
Build the setup .msi installer#
After building the
Release configuration of
XmlNotepad.sln load the
solution uses the WIX Toolset to build a standalone windows .msi
installer. To build that setup you will need to install the WIX toolset then the Wix Toolset Visual
Then right click the
XmlNotepadSetup project and select "build". This will produce an .msi installer in the
XmlNotepadSetup\bin\release folder. There is also a
sign.cmd script invoked by this build that will try and sign the
resulting .msi using the certificate installed by the author. This step will only work for the author who owns the
msi installer gives folks the option to install XML Notepad on machines that are isolated from the internet and
there are quite a few customers who have requested this, which is why it exists.
Build the winget setup package#
winget setup package is built by the
XmlNotepadPackage project in the
solution. Right click this project in the Solution Explorer and select
Packages. Choose Sideloading, and the package files will be written to the
XmlNotepadPackage\AppPackages folder. These can then be uploaded to the server hosting these
packages and you can then update the manifest in
This package provides the
winget install xmlnotepad setup option.
Publishing the bits to Azure Blob Store#
publish.cmd script then takes all the above built binaries and collects them together and uploads
them to the appropriate places in Azure using AzurePublishClickOnce and it also prepares a new manifest for
This step uses an environment variable named
LOVETTSOFTWARE_STORAGE_CONNECTION_STRING to find the
Azure storage account.
See XML Notepad Design for more detailed information about how this application is designed.
Feedback and suggestions are welcome, just use the GitHub issues list. Pull requests are also welcome, in fact, a number of good pull requests have already been merged. Thanks to all who are helping to make XML notepad a great tool!