5

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.

Matthew Watson
  • 104,400
  • 10
  • 158
  • 276

2 Answers2

6

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.

Amit Mittal
  • 2,646
  • 16
  • 24
0

I have used config file to run the application in other .NET frameworks along with compiled framework. For Example if we use CLR 2.0 (.NET framework 2.0 or 3.5) that application didn’t run in .NET Framework 4.0 alone installed machine. In that case if we set the below code in configure file and place the configure file along with application it will run in Framework 4.0 alone installed machine.

<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v2.0.50727"/>
<supportedRuntime version="v4.0"/>

I hope the same reason to use the Configure file here.

Vinoth
  • 1,975
  • 21
  • 34
  • Thanks for the reply, but I don't think it tells me if it is ok to rename the file (I'm worried that it won't actually be used if I change the names of the classes etc). – Matthew Watson Aug 24 '12 at 08:43