本文介绍了如何将现有项目添加到Visual Studio项目,复制到输出但更改其原始名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了一个chm帮助文件作为该应用程序项目的链接,但该文件名不利于向公众发布(已编译的help.chm)。不幸的是,其他人将其维护在其他git子模块中,并且其名称是其帮助生成器的自动输出。

I added a chm help file as link to the application's project but it's file name is not good for releasing to the public ("Compiled help.chm"). Unfortunately it's maintained in a different git submodule by other people and it's name is an automated output from their help builder.

在将文件添加为链接之后,无法更改文件名。是否有csproj xml功能允许用户重命名文件链接,而不必依赖它而损坏WiX安装程序以及其他不良后果?

After adding file as link there is no option to change the file name. Is there a csproj xml feature allowing user to rename a file link, possibly without breaking WiX installers depending on it and other undesired consequences?

推荐答案

我对此有点好奇,所以我自己尝试了一下,我想我能够得到一些对您有用的东西:

I was a bit curious about this one, so I gave it a try myself, and I think I was able to get something that will work for you:


  1. 如果您已经在项目中将文件作为链接,请跳至2; o / w,将文件拖到Visual Studio中的项目上,然后-在按住Ctrl和Shift的同时 -将文件拖放到项目上,创建链接。

  2. 关闭解决方案和项目

  3. 使用记事本或其他文本编辑器,编辑.csproj文件,然后通过查找刚添加的文件名找到逻辑链接。

  4. 按如下所示编辑链接节点:

  1. If you have the file already in your project as a link, skip to 2; o/w, drag the file over your project in Visual Studio and - while holding down both Ctrl and Shift - drop the file on your project, creating a link.
  2. Close the solution and project
  3. Using notepad or some other text editor, edit the .csproj file, then locate your logical link by looking for the filename you just added.
  4. Edit the link node as follows:



<ItemGroup>
    <None Include="....\OtherTeamOutputFolder\Compiled help.chm">
        <Link>Super Cool Production Product Name.chm</Link>
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
</ItemGroup>




  1. 构建您的项目;见证荣耀。

这篇关于如何将现有项目添加到Visual Studio项目,复制到输出但更改其原始名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 02:23