Visual Studio清单工具不接受多个其他清单文件吗? [英] Visual-Studio Manifest Tool doesn't accept multiple Additional Manifest Files?

查看:192
本文介绍了Visual Studio清单工具不接受多个其他清单文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TL; DR (如何)是可以使Visual Studio(2010-2015)通过实际的Additional Manifest Files GUI/props选项(而不是通过)接受多个清单文件(合并).通过变通办法)?

TL;DR (How) is it possible to get Visual Studio (2010 - 2015) to accept multiple manifest files (to merge) via the actual Additional Manifest Files GUI / props option (and not via workarounds)?

我的C ++应用程序嵌入了其他清单文件(包含私有文件组件信息)通过Visual-C ++设置:Cfg Properties > Manifest Tool > Input and Output > Additional Manifest Files

My C++ application embeds an additional manifest file (containing Private Assembly info) via the Visual-C++ Setting: Cfg Properties > Manifest Tool > Input and Output > Additional Manifest Files

此功能符合预期.

现在,我需要添加/合并到另一个清单文件.由于该选项称为其他清单文件_s_",并且这是一个多行编辑框,因此我尝试在此处添加要合并的第二个文件:

Now, I need to add/merge in a second manifest file. Since the option is called "Additional Manifest File_s_", and this is a multi-line edit box, I tried adding the second file to be merged here:

VS 2015告诉我:

VS 2015 the tells me:

1>LINK : fatal error LNK1104: cannot open file 'private-assem.manifest my-compat.manifest'

VS 2010告诉我:

VS 2010 tells me:

2>private-assem.manifest my-compat.manifest : general error c1010070: Failed to load and parse the manifest. Das System kann die angegebene Datei nicht finden.

这里要注意的是,这两个工具都将两个文件显示为一个文件,实际上,在命令行中,我们看到:(请注意引号)

what is of note here is that both tools show the two files concatenated as one, and indeed, looking at the command line, we see: (note the quotes)

/manifest "private-assem.manifest my-compat.manifest" /verbose /out:"Debug\ConsoleApplication2.exe.embed.manifest" /nologo "Debug\ConsoleApplication2.exe.embed.manifest.res"

并进一步研究我们看到的mt.exe帮助:

and further looking into the mt.exe help we see:

C:\Program Files (x86)\Microsoft Visual Studio 14.0>mt /?
Microsoft (R) Manifest Tool version 6.3.9600.17336
Copyright (c) Microsoft Corporation 2012.
All rights reserved.

Usage:
-----
mt
    [ -manifest <manifest1 name> <manifest2 name> ... ]
...

请注意,清单文件选项之间用空格分隔 ,因此VS传递给mt.exe的原因就是humbug,因为它将两个文件都用一个引号引起来.

Note that the manifest file options are space separated and thus what VS passes to mt.exe is humbug, because it encloses both files in a single quote string.

有什么方法可以使Additional Manifest Files选项实际上适用于多个文件?还是我做错了什么?

Is there any way to make the Additional Manifest Files option actually work for multiple files? Or am I doing something wrong?

我可以想到以下可能的解决方法:

I can think of the following possible workarounds:

  • 尝试通过预链接步骤和手动调用mt.exe一起破解某些东西(未尝试:太可怕了)
  • 实际上将清单文件作为文件项添加到VS项目中:这可以工作,但是:

将多个.props属性表组合到一个项目中时出现了实际情况,其中一个使用专用程序集,另一个使用应用程序兼容性声明.因此,设置不是驻留在实际项目本身上,而是驻留在项目中包含的属性表上.

The actual situation arose when combining multiple .props property sheets into a single project, where one specced a private assembly and the other specced the application compatibility declaration. So the settings do not reside on the actual project itself, but on property sheets that are included in the project.

我还包括了标记的问题在这个问题上,因为我是

I'm also including the msbuild tag in the question, as I'm

  1. 不确定该归咎于什么-VS或MSBuild
  2. 也许有可能会破解.props.vcxproj文件以使其正常工作
  1. not sure what is to blame for this - VS or MSBuild
  2. maybe there's a possibility hacking the .propsor .vcxproj files to make this work

推荐答案

汉斯的评论出现在以下地方:

Hans' comment was spot on:

...空格不是文件分隔符. 在文件名之间放入分号.

... a space is not a file separator. Put semicolons between the file names.

在属性中的每个.manifest文件名之后添加seimcolon ;可以达到目的. VS/MSBuild(无论使用哪种方式)都会正确引用/manifest选项.

Adding a seimcolon ; after each .manifest filename in the properties does the trick. VS / MSBuild (whoever) will the quote the /manifestoption correctly.

也就是说,而不是指定:

That is, instead of specifying:

  <ItemDefinitionGroup>
    <Manifest>
      <AdditionalManifestFiles>somefile.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
    </Manifest>
  </ItemDefinitionGroup>

所有属性表文件(实际上是所有Additional Manifest Files设置)都可以(并且应该)在每个文件名后附加一个分号(在仅指定单个文件名时也要这样做,以便可以将其正确组合到多个属性表中):

all property sheet files (indeed all Additional Manifest Files settings) can (and should) append a semicolon to each filename (also do this when only speccing a single one, so that it will be combined correctly for multiple property sheets):

  <AdditionalManifestFiles>somefile.manifest; %(AdditionalManifestFiles)</AdditionalManifestFiles>
                                           ^^^

这篇关于Visual Studio清单工具不接受多个其他清单文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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