Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
可以为WiX C#自定义操作重命名(针对visualstudio)生成的类和程序集吗?_C#_Wix_Custom Action - Fatal编程技术网

可以为WiX C#自定义操作重命名(针对visualstudio)生成的类和程序集吗?

可以为WiX C#自定义操作重命名(针对visualstudio)生成的类和程序集吗?,c#,wix,custom-action,C#,Wix,Custom Action,当我在Visual Studio 2010中使用WiX 3.x创建名为“MyCustomActions”的Windows Installer XML“C#Custom Action Project”时,它会生成以下文件: “CustomAction.config”、“CustomAction.cs”和项目文件“MyCustomActions.csproj” 我们使用包含公司名称的程序集命名方案,因此我们将程序集名称更改为:CompanyName.ProductName.MyCustomActio

当我在Visual Studio 2010中使用WiX 3.x创建名为“MyCustomActions”的Windows Installer XML“C#Custom Action Project”时,它会生成以下文件:

“CustomAction.config”、“CustomAction.cs”和项目文件“MyCustomActions.csproj”

我们使用包含公司名称的程序集命名方案,因此我们将程序集名称更改为:CompanyName.ProductName.MyCustomActions

同时,我们将CustomActions类的默认命名空间和实际命名空间更改为CompanyName.ProductName.MyCustomActions,以匹配assemblyname

在不更改任何其他文件或类名的情况下执行此操作可以吗

我想知道的是“CustomAction.config”文件的使用——它的名称是否必须以某种方式与输出程序集名称相关?我不确定“CustomAction.config”将如何使用

另外:“CustomAction.cs”文件包含一个名为“CustomActions”的类(注意复数形式),我们的命名约定是,类的代码文件应该与类本身具有相同的名称,因此我们希望将代码文件重命名为“CustomActions.cs”。我很确定那没关系。。。是吗

最后,如果我们将CustomAction类重命名为其他类,可以吗?同样,我只关心它与“CustomAction.config”的关系

我想所有这些问题都可以归结为一个问题:“CustomAction.config”文件名与其余名称空间、程序集和类名之间的关系是什么


如果我有这个问题的答案,它将回答我之前的所有问题。

我使用配置文件在其他.NET框架以及编译框架中运行应用程序。 例如,如果我们使用CLR 2.0(.NET framework 2.0或3.5),则该应用程序不会在单独安装的.NET framework 4.0计算机中运行。在这种情况下,如果我们在configure文件中设置下面的代码,并将configure文件与应用程序一起放置,它将在Framework4.0单独安装的机器中运行

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


我希望在这里使用配置文件也是出于同样的原因

对于WIX自定义操作项目,无论您如何命名类、程序集、命名空间或任何其他名称,配置文件必须始终命名为“CustomAction.config”(考虑在WIX中对其进行硬编码),并且其在VS中文件属性中的构建操作应设置为“Content”。本项目中没有任何其他要求

此配置文件可以指定受支持的CLR版本(事实上是推荐的),并且可以包含自定义操作dll可能需要的任何其他配置


您的dll将能够使用标准的.Net app config API读取这些额外的配置设置。

谢谢您的回复,但我认为它不会告诉我是否可以重命名该文件(我担心如果我更改类的名称等,它实际上将不会被使用)。