Search code examples
c#wixcustom-action

Is it ok to rename the class and assembly generated (for Visual Studio) for a WiX C# custom action?


When I use WiX 3.x with Visual Studio 2010 to create a Windows Installer XML "C# Custom Action Project" called "MyCustomActions", it generates the following files:

"CustomAction.config", "CustomAction.cs" and the project file "MyCustomActions.csproj".

We use an assembly naming scheme that includes our company name, so we change the assembly name to something like: CompanyName.ProductName.MyCustomActions

At the same time, we change the default namespace and actual namespace for the CustomActions class to CompanyName.ProductName.MyCustomActions, to match the assemblyname .

Is it OK to do this without changing any other file or class names?

The thing I'm wondering about is the use of the "CustomAction.config" file - does the name of that have to be related to the output assembly name in some way? I'm not sure how "CustomAction.config" will get used.

Also: The "CustomAction.cs" file contains a class called "CustomActions" (note the plural), and our naming convention says that the code file for a class should have the same name as the class itself, so we would like to rename the code file to "CustomActions.cs". I'm pretty sure that's OK... Is it?

Finally, if we did rename the CustomAction class to something else, would that be OK? Again, I'm just concerned with its relationship to "CustomAction.config".

I guess all these questions can be rolled into one: What is the relationship between the name of the "CustomAction.config" file with the rest of the namespace, assembly and class names?

If I have the answer to that, it would answer all my previous questions.


Solution

  • For a WIX Custom Action project, no matter what you name your classes or assembly or namespace or anything else, the config file must always be named 'CustomAction.config' (consider it hard-coded in WIX) and its build action in the file property in VS should be set to 'Content'. There is no such requirement for anything else in the project.

    This config file can specify the supported CLR version (in fact it is recommended) and can contain any additional configuration that your custom action dll might require.

    Your dll will be able to read these additional configuration settings using standard .Net app config API.