如何修复“找不到具有自定义操作文件的安装项目”异常? [英] How do I fix 'Setup project with custom action file not found' exception?

查看:108
本文介绍了如何修复“找不到具有自定义操作文件的安装项目”异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为Windows服务创建安装项目。我已按照 http://support.microsoft.com/kb/816169 上的指示进行操作。轻松创建安装项目。

I am trying to create a setup project for a Windows Service. I've followed the directions at http://support.microsoft.com/kb/816169 to create the setup project with no trouble.

我希望能够在安装过程中获得一个值,以便使用用户所需的设置更新app.config。我添加了一个文本框(A)对话框来检索值。我将 Edit1Property 属性设置为 TIMETORUN,并在主输出操作的 CustomActionData 属性中输入以下内容: / TimeToRun = [TIMETORUN] \ 。到现在为止还挺好。运行安装程序,我可以从 Context.Parameters 集合中检索 TimeToRun 值,而不会出现问题。

I want to be able to get a value during the installation in order to update the app.config with the user's desired settings. I added a Textboxes (A) dialog to retrieve the values. I set the Edit1Property property to "TIMETORUN", and in my Primary Output action's CustomActionData property I put in the following: /TimeToRun="[TIMETORUN]\". So far so good. Running the setup I can retrieve the TimeToRun value from the Context.Parameters collection without issue.

找到app.config,我还需要将 TARGETDIR Windows Installer属性的值传递给我的自定义操作。这是事情开始崩溃的地方。为了实现这一点,必须像上面那样更改上面的 CustomActionData / TimeToRun = [TIMETORUN] \ / TargetDir = [TARGETDIR] \ 。现在,当我运行安装程序时,会收到以下错误消息:

In order to locate the app.config I need to also pass in the value of the TARGETDIR Windows Installer Property to my custom action. This is where things begin to fall apart. In order to achieve this, the above CustomActionData must be altered like so: /TimeToRun="[TIMETORUN]\" /TargetDir="[TARGETDIR]\". Now when I run the setup I get the following error message:


错误1001。初始化安装时发生了异常。
System.IO.FileNotFoundException:无法加载文件或程序集 file:/// C:\Windows\SysWOW64\Files或其依赖项之一。系统无法
找到指定的文件。

Error 1001. Exception occurred while initializing the installation. System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Windows\SysWOW64\Files' or one of its dependencies. The system cannot find the file specified.

如果您用Google搜索这个问题,您将不可避免地发现仅仅通过简单操作就能获得巨大成功的人将斜杠添加到 CustomActionData / TargetDir = [TARGETDIR] \ 部分。不幸的是,这不能解决我的问题。

If you google this problem you will inevitably find people having tremendous success by simply adding the trailing slash to the /TargetDir="[TARGETDIR]\" portion of the CustomActionData. This unfortunately does not solve my issue.

我尝试了 CustomActionData 字符串的许多不同变体,但没有一个起作用。我尝试通过覆盖的 Install 方法记录到文件中以确定损坏的位置,但是没有创建日志文件,因为它甚至还没有到。如错误所示,失败是在初始化步骤期间进行的。

I tried so many different variations of the CustomActionData string and none of them worked. I tried logging to a file from my overridden Install method to determine where the breakage was, but no log file is created because it's not even getting that far. As the error indicates, the failure is during the Initialization step.

我有一种直觉,认为这可能是安装项目试图加载的依赖项之一。也许以某种方式将某些内容附加到 CustomActionData 字符串上,并且与 TARGETDIR 值(包含空格,即 C:\Program Files\My公司\项目名称)。再次,这是我似乎无法确认的另一种直觉,因为我无法调试设置过程。

I have a hunch that it could be one of the dependencies that the setup project is trying to load. Perhaps somehow something is being appended to the CustomActionData string and isn't playing well with the TARGETDIR value (which contains spaces, i.e. "C:\Program Files\My Company\Project Name"). Again, this is another hunch that I cannot seem to confirm due to my inability to debug the setup process.

还有另一件事要说,是另一种直觉,可以这是Windows 64位版本上的安装项目的问题吗?我正在运行Windows 7 Professional。

One further thing to mention, and yes it's another hunch, could this be an issue with Setup Projects on 64-bit version of Windows? I'm running Windows 7 Professional.

如果有帮助,我将提供依赖项的名称:

I'll provide names of the dependencies in case it helps:


  • Microsoft .NET Framework

  • Microsoft.SqlServer.DtsMsg.dll

  • Microsoft.SqlServer.DTSPipelineWrap.dll

  • Microsoft.SqlServer.DTSRuntimeWrap.dll

  • Microsoft.SQLServer.ManagedDTS.dll

  • Microsoft.SqlServer.msxml6_interop .dll

  • Microsoft.SqlServer.PipelineHost.dll

  • Microsoft.SqlServer.SqlTDiagM.dll

  • Microsoft .NET Framework
  • Microsoft.SqlServer.DtsMsg.dll
  • Microsoft.SqlServer.DTSPipelineWrap.dll
  • Microsoft.SqlServer.DTSRuntimeWrap.dll
  • Microsoft.SQLServer.ManagedDTS.dll
  • Microsoft.SqlServer.msxml6_interop.dll
  • Microsoft.SqlServer.PipelineHost.dll
  • Microsoft.SqlServer.SqlTDiagM.dll

您可能会从依赖项中收集信息,Windows Service正在安排对DTSX程序包的调用。

As you may glean from the dependencies, the Windows Service is scheduling a call to a DTSX package.

很抱歉, 。谢谢您能提供的任何帮助。

Sorry for the long rant. Thanks for any help you can provide.

推荐答案

答案如此简单。如果 CustomActionData 中的最后一个参数将包含空格,因此必须用引号和尾部斜杠将其引起来,则还必须在尾部斜杠后留一个空格,像这样:

The answer is so maddeningly simple. If the last argument in the CustomActionData is going to contain spaces and thus you have to surround it with quotes and a trailing slash, you must also have a space following the trailing slash, like this:

/TimeToRun="[TIMETORUN]\" /TargetDir="[TARGETDIR]\ "

可以找到解决方案和解释此处

The solution and explanation can be found here.

这篇关于如何修复“找不到具有自定义操作文件的安装项目”异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆