简体   繁体   English

在Visual Studio 2005 C ++中设置文件版本号

[英]Setting file version number in Visual Studio 2005 C++

Can anyone point me in the right direction how to configure Visual Studio 2005 with our C++ console project how we can include a 'File Version' in the details section of the file properties. 任何人都可以向我指出正确的方向,如何使用C ++控制台项目配置Visual Studio 2005,以及如何在文件属性的详细信息部分中包含“文件版本”。

I've tried resource files without any luck. 我试过资源文件没有任何运气。 This is with a C++ project just for clarification, and big thank you for the guys you responded with C# suggestions. 这是为了澄清C ++项目,非常感谢您回答C#建议的人。

Thanks in advance. 提前致谢。

If you are talking about unmanaged c++, you need to add a version resource to the project. 如果要谈论非托管c ++,则需要向项目中添加版本资源。

right-click on the project, choose add - Resource.... Choose Version and press new. 右键单击项目,选择添加-资源...。选择版本,然后按新建。 There you can enter all info you need. 您可以在此处输入所需的所有信息。

You have to have one VS_VERSION_INFO section in your resource (*.rc) file(s) that compile into your project. 您的资源(* .rc)文件中必须有一个VS_VERSION_INFO节, VS_VERSION_INFO节可以编译到项目中。

In the Visual Studio 2005 Solution Explorer, open the context menu on your C++ project and choose Add, Resource. 在Visual Studio 2005解决方案资源管理器中,打开C ++项目的上下文菜单,然后选择“添加”,“资源”。

Mark Version and click "New". 标记版本,然后单击“新建”。

Fill in the fields as desired and save the file. 根据需要填写字段并保存文件。

Build. 建立。

Now your project output has a FileInfo resource. 现在,您的项目输出具有FileInfo资源。

Please be aware that Windows Vista does not show all available version info in the Explorer context menu's "Details" tab. 请注意,Windows Vista不会在资源管理器上下文菜单的“详细信息”选项卡中显示所有可用的版本信息。

对于c ++项目,我使用StampVer并将其称为构建后操作,包括签入/签出发行版本的版本控制。

Unless you have a good reason for your file version to be different than the version of the assembly inside, I think it is a better idea to provide the AssemblyVersion alone. 除非您有充分的理由使您的文件版本不同于内部程序集的版本,否则我认为最好单独提供AssemblyVersion If you do not specify an AssemblyFileVersion , it will automatically get the same value, so you can see your assembly's version directly in the file's properties. 如果未指定AssemblyFileVersion ,它将自动获得相同的值,因此您可以直接在文件属性中查看程序集的版本。

The advantage is that you can use a wildcard and allow the version to be automatically incremented, so that every time you compile the library you get a different build and/or revision number. 优点是您可以使用通配符并允许版本自动递增,这样,每次编译库时,您都会获得一个不同的内部版本号和/或修订版号。 As far as I can tell, this trick does not work with AssemblyFileVersion , so you have to increment it by hand. 据我所知,这招不起作用的AssemblyFileVersion,所以你必须手动增加它。

Of course, all this only applies if you're writing .NET code. 当然,所有这些仅在您编写.NET代码时适用。 Are you by any chance talking about a project using unmanaged code? 您是否有机会谈论使用非托管代码的项目?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM