windows VS2010:在应用程序构建中设置文件详细信息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4070360/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:31:01  来源:igfitidea点击:

VS2010: Setting Up File Details on Application Build

c++windowsvisual-studiovisual-studio-2010

提问by Bunkai.Satori

After I right-click on a file in Windows (ex: Windows 7 64bit), a pop-up menu appears with "Properties"on its bottom.

在 Windows 中右键单击文件(例如:Windows 7 64 位)后,会出现一个底部带有“属性”的弹出菜单。

Going to: Mouse-Right-Click on a File -> Properties -> DetailsI get a tab with file description containing:

转到:鼠标右键单击文件 -> 属性 -> 详细信息我得到一个包含文件描述的选项卡:

  • File Description
  • Type
  • File Version
  • Product Version
  • Copyright
  • Size
  • Date modified
  • Language
  • 文件描述
  • 类型
  • 文件版本
  • 产品版本
  • 版权
  • 尺寸
  • 修改日期

Is it possible to setup any of the above parameters (Example: File Version, Product Version, Copyright) from within Visual Studio 2010? I want to have the parameters available after each compile/build session.

是否可以在Visual Studio 2010 中设置上述任何参数(例如:文件版本、产品版本、版权)?我希望在每次编译/构建会话后都有可用的参数。

If yes, how to do that? If not, what is the appropriate way of setting them up? I did not find anything relevant on internet yet.

如果是,如何做到这一点?如果没有,设置它们的适当方法是什么?我还没有在互联网上找到任何相关的内容。

回答by Gene Bushuyev

In Visual C++ project add a resource file with version information. See MSDN help: http://msdn.microsoft.com/en-us/library/aa381058(v=VS.85).aspx

在 Visual C++ 项目中添加一个包含版本信息的资源文件。请参阅 MSDN 帮助:http: //msdn.microsoft.com/en-us/library/aa381058(v= VS.85).aspx

回答by elcudro

I am currently using VS2015, to our project contained additional information, follow these steps:

我目前使用的是VS2015,为了我们的项目所包含的附加信息,请按照以下步骤操作:

  1. In Solution Explorer select project and then: mouse-right-click on a Project -> Add -> New Item.
  2. Then on the left side in the new window, select: Installed -> Visual C ++ -> Resource.
  3. Choose Resource File (rc). Enter the name for example Version.
  4. When you see the Resource View on the previously entered name file, right click mouse and from the context menu select Add resource.
  5. With resource type select Version and then click in the New button.
  1. 在解决方案资源管理器中选择项目,然后:鼠标右键单击项目 -> 添加 -> 新项目。
  2. 然后在新窗口的左侧,选择:Installed -> Visual C++ -> Resource。
  3. 选择资源文件 (rc)。输入名称,例如版本。
  4. 当您在先前输入的名称文件上看到资源视图时,右键单击鼠标并从上下文菜单中选择添加资源。
  5. 使用资源类型选择版本,然后单击新建按钮。

Fill the data and rebuild the project. Done.

填写数据并重建项目。完毕。

回答by dretzlaff17

Update you assembly file based on the executable or class library you are building. I hope this is what you are looking for.

根据您正在构建的可执行文件或类库更新您的程序集文件。我希望这就是你要找的。

[assembly: AssemblyTitle("My Product Name")]
[assembly: AssemblyDescription("My Product Description")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("My Company")]
[assembly: AssemblyProduct("My Product Name")]
[assembly: AssemblyCopyright("Copyright ? My Company 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]