在 Visual Studio 2005 C++ 中设置文件版本号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/308307/
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
Setting file version number in Visual Studio 2005 C++
提问by wimh
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.
提前致谢。
回答by wimh
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.
右键单击项目,选择添加 - 资源...。选择版本并按新建。在那里你可以输入你需要的所有信息。
回答by user33675
You have to have one VS_VERSION_INFO
section in your resource (*.rc) file(s) that compile into your project.
您VS_VERSION_INFO
的资源 (*.rc) 文件中必须有一个部分可以编译到您的项目中。
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 不会在资源管理器上下文菜单的“详细信息”选项卡中显示所有可用版本信息。
回答by kenny
回答by Tiberiu Ana
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 AssemblyVersionalone. 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.
除非您有充分的理由让您的文件版本与内部程序集的版本不同,否则我认为单独提供AssemblyVersion是一个更好的主意。如果您不指定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 notwork with AssemblyFileVersion, so you have to increment it by hand.
优点是您可以使用通配符并允许版本自动递增,以便每次编译库时都会获得不同的构建和/或修订号。据我所知,这招确实没有工作,的AssemblyFileVersion,所以你必须手动增加它。
Of course, all this only applies if you're writing .NET code. Are you by any chance talking about a project using unmanaged code?
当然,所有这些仅适用于您编写 .NET 代码的情况。您是否有机会谈论使用非托管代码的项目?