"Dialogs" type are not recognized

Jul 31, 2015 at 10:46 AM
I followed procedure of installation.
When I try to compile your "WixSharp Managed Setup - Custom Dialog"
which has:
project.InjectClrDialog("ShowCustomDialog", Dialogs.InstallDirDlg, Dialogs.VerifyReadyDlg);

it shows error:
_Error 3 The name 'Dialogs' does not exist in the current context D:\MyWorking\SjPdf_Installer\WixSharp.\Templates\ProjectTemplates\WixSharp Managed Setup - Custom Dialog\setup.cs

All references are resolved properly. VS2013
Jul 31, 2015 at 12:35 PM
Actually "WixSharp Managed Setup - Custom Dialog" project template doesn't have "project.InjectClrDialog...". This call can be found in the code sample "EmptyDialogSample.cs" but not in any of the VS project templates.

BTW, judging from the error text you provided you still load the project template instead creating a project from it. If you are really trying to avoid working with templates then you will be better off by copying one of the corresponding sample projects (e.g. <Wix# Samples>\Managed Setup\CustomUIDialog).
Jul 31, 2015 at 1:04 PM
Sorry, I don't really get you. What do you mean by "creating a project from it"?
Jul 31, 2015 at 1:48 PM
"VS Project Template" and "VS Project" are not the same things. Project is intended to be loaded in VS with the intention to build a binary.
Template is not used for building anything. Instead templates are intended to be installed (integrated in VS). After the installation VS can use the templates to create projects for further building various binaries. Every time you create a new project in VS an appropriate template is used as a blueprint for this project.

Templates can be installed manually (I cannot recommend it for you) or as VS Extension (this is the recommended way). In fact yesterday I have removed templates from the release downloadable package as your feedback on your experiences indicated that users can easily run into problems when installing templates manually. And now it is only possible to install templates as a VS extension. It has to be done from the VS Extension Manager.

When the templates are installed you can create the project as "New Project->C# -> WixSharp -> WixSharp Managed Setup - Custom Dialog". You can find some details on this here: https://wixsharp.codeplex.com/wikipage?title=Visual%20Studio%20Project%20Templates
Jul 31, 2015 at 1:51 PM
Do I have to add Windows Form project? or do I have to Add Project - > Somehow choose template for project?
Jul 31, 2015 at 2:14 PM
Edited Jul 31, 2015 at 2:19 PM
No. Not a Windows Form, not a Console Application nor any other non-WixSharp project type.
As per my previous email "New Project->C# -> WixSharp -> WixSharp Managed Setup - Custom Dialog"
Jul 31, 2015 at 2:58 PM
sorry. I did a post before I actually saw your answer
Aug 1, 2015 at 3:25 AM
Not a problem.

As for "building the MSI" keep in mind that every WixSharp VS project is a C# project that defines building an exe. This exe is an "MSI builder", which if executed uses WiX compilers to produce the final msi.

Thus if you just create manually a simple ConsoleApp project with the Wix# code (as below) and compile it it will build an exe but not msi.
class Script
    static public void Main()
        var project = new Project("CustomActionTest",
                new ManagedAction("MyAction", Return.check, When.After, Step.InstallInitialize, Condition.NOT_Installed));


public class CustomActions
    public static ActionResult MyAction(Session session)
        MessageBox.Show("Hello World!");
        return ActionResult.Success;
However if you run the produced exe (e.g. F5) it in turn will build the desired msi. Instead of running the exe manually every time you can automate it by setting the project post-build event:

All Wx# VS samples are composed this way.

All proper WixSharp VS project templates already come with the post-build exe execution scheduled. Though not via the post-build events but rather with *.targets, but that doesn't make any difference for the user.

Hope it helps