无法在 Visual Studio 2010 安装程序项目中添加自定义操作

发布于 2024-10-18 06:00:33 字数 633 浏览 1 评论 0原文

我将一个工作项目从 Visual Studio 2008 转换为 VS2010。 C++ 解决方案构建一个可执行文件和 3 个 DLL,以及一个 Windows 安装程序项目。

转换到VS2010后,我收到一个构建错误:

无法从项目输出组“主输出”构建名为“来自 xxxx 的主输出(活动)”的自定义操作,因为项目输出组没有密钥文件。

我删除并重新添加了输出组,然后尝试添加自定义操作。可执行输出未列为自定义操作的候选。然后,我注意到当我选择可执行的“主输出”属性时,KeyOutput属性被设置为(无)并且呈灰色。

重新访问 VS2008 版本时,KeyOutput 属性并未灰显。我在MSDN上找到了错误消息,并进行了无用的修复:

删除自定义操作并将其替换为指向具有密钥文件的项目输出组的自定义操作。

显然,技术作家也不知道如何解决它。请记住原始版本可以正确运行并安装。我相信根本问题是为什么 KeyOutput 属性被禁用 - 但为什么呢? (查看“输出”时,它会正确显示每个项目中的 EXE 或 DLL)。

I converted a working project from Visual Studio 2008 to VS2010. The C++ solution builds a single executable and 3 DLLs, and a windows installer project.

After converting to VS2010, I received a build error:

Unable to build custom action named 'Primary Output from xxxx (Active)' from project output group 'Primary Output' because the project output group does not have a key file.

I removed and re-added the output groups, then attempted to add a custom action. The executable output was not listed as a candidate for a custom action. I then noticed when I selected the executable "Primary Output" properties, that the KeyOutput property was set to (None) and was grayed out.

When revisiting the VS2008 version, the KeyOutput property was not grayed out. I found the error message on MSDN, with a useless fix:

Remove the custom action and replace it with a custom action pointing to a project output group that has a key file.

Obviously, the tech writer didn't know how to fix it either. Keep in mind the original build worked and installed correctly. I believe the root issue is why the KeyOutput property is disabled - but why? (When viewing "Outputs" it correctly shows the EXE or DLL in each project).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

身边 2024-10-25 06:00:33

我遇到了类似的问题,我弄清楚了为什么安装项目找不到关键输出文件。

我的项目输出目录定义为 $(SolutionDir)\bin\$(Platform)。 SolutionDir 已经有一个尾部反斜杠,因此 \bin 在路径中放置了一个双反斜杠。该项目可以正常构建,但安装项目无法解决关键输出。将输出设置为 $(SolutionDir)bin\$(Platform)\ 解决了该问题。

I had a similar problem and I figured out why the setup project could not find the key output files.

My project Output Directory was defined as $(SolutionDir)\bin\$(Platform). SolutionDir already has a trailing backslash so the \bin was placing a double backslash in the path. The project would build fine but the setup project couldn't resolve the key outputs. Setting the output to $(SolutionDir)bin\$(Platform)\ resolved the issue.

生寂 2024-10-25 06:00:33

经过进一步调查,我发现这是 Visual Studio 2010 中的一个错误。

如果您为项目指定的输出名称与项目本身的名称不同,它将无法执行正确的操作。

要重现此问题,请更改

项目属性->链接器->常规->OutputFile$(OutDir)$(TargetName)$(TargetExt) 类似于 $(OutDir)foobar.exe

然后,项目将 KeyOutput 值更改为空,并且不可用于安装中的自定义操作。除了使用默认的项目命名约定之外,没有其他解决方法。

After further investigation, I found this is a bug in Visual Studio 2010.

If you specify an output name for a project that differs from the name of the project itself, it fails to do the right thing.

To reproduce this, change

Project properties->Linker->General->OutputFile from $(OutDir)$(TargetName)$(TargetExt) to be something like $(OutDir)foobar.exe.

The project then changes the KeyOutput value to empty, and is not available for custom actions in installations. No workaround other than living with the default project naming convention.

无力看清 2024-10-25 06:00:33

答案很晚,但希望它能节省我在 VS 2010 上用头撞墙的 2 个小时(这是一个多么糟糕的软件——加载缓慢,每个 devenv 占用 300 兆工作内存,现在这个错误!!!!!!????)这里是 -
Roger Dunn 是正确的,它是项目属性 - >链接器 - >常规 - >输出文件导致了问题 - 如果你有类似 $(OutDir)foobar.exe 的自定义操作 barfs ,如果你改变它回到 $(OutDir)$(TargetName)$(TargetExt) 它又可以工作了!

解决方法是将宏 $(TargetName) 更改为 foobar,然后如果您想要为 exe 自定义名称,则将用户 $(OutDir)$(TargetName)$(TargetExt) 更改为用户。

$(TargetName) 可以在 - 项目属性 -> 配置属性 -> 常规 -> TargetName 中更改。

但这VS 2010真是浪费时间。

Very late answer but hopefully it will save someone the 2 hours I spent banging my head on the wall with VS 2010 ( what an awful piece of software it is - slow to load and takes up 300 megs of working memory per devenv , and now this bug!!!!!????) here goes -
Roger Dunn was correct is saying that it is the Project properties->Linker->General->OutputFile that causes the problem - if you have something like $(OutDir)foobar.exe the custom action barfs , if you change it back to $(OutDir)$(TargetName)$(TargetExt) it works again!

The work around is to change the macro $(TargetName) to foobar and then user $(OutDir)$(TargetName)$(TargetExt) if you want custom name for your exe.

$(TargetName) can be changed at - Project properties->Configuration Properties->general->TargetName.

But what a waste of time this VS 2010.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文