Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you set the version of a C++/CLI project in Visual Studio?

Tags:

I am working with a C++/CLI Project that wraps a C++ Native Library in Visual Studio 2012.

My C++/CLI Project has an AssemblyInfo.cpp. I set all the fields there, which include an "AssemblyVersionAttribute". However when I built my project and check its properties in the Windows Explorer, the version information is empty.

This is my first C++/CLI project, I have been going over all the options in the project properties but I couldn't find any that works for setting the version.

How do you set the version for a C++/CLI Project?


Update

I will add the content of my AssemblyInfo.cpp. I just filled in the fields that were present, this was automatically generated when I created the project.

using namespace System; using namespace System::Reflection; using namespace System::Runtime::CompilerServices; using namespace System::Runtime::InteropServices; using namespace System::Security::Permissions;  [assembly:AssemblyTitleAttribute("MyTitle")]; [assembly:AssemblyDescriptionAttribute("")]; [assembly:AssemblyConfigurationAttribute("")]; [assembly:AssemblyCompanyAttribute("")]; [assembly:AssemblyProductAttribute("MyProduct")]; [assembly:AssemblyCopyrightAttribute("Copyright © 2014")]; [assembly:AssemblyTrademarkAttribute("Inc")]; [assembly:AssemblyCultureAttribute("")]; [assembly:AssemblyVersionAttribute("3.9.0")]; [assembly:ComVisible(false)]; [assembly:CLSCompliantAttribute(true)]; [assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)]; 
like image 548
Dzyann Avatar asked Apr 21 '14 19:04

Dzyann


People also ask

How do I select C++ version in Visual Studio?

To set this compiler option in the Visual Studio development environment. Open the project's Property Pages dialog box. For more information, see Set C++ compiler and build properties in Visual Studio. Select the Configuration Properties > C/C++ > Language property page.

How can I change C++ compiler in Visual Studio?

In Visual Studio You can set compiler options for each project in its Visual Studio Property Pages dialog box. In the left pane, select Configuration Properties, C/C++ and then choose the compiler option category.

How do I know my compiler version in Visual Studio 2019?

Before you start, you should add the -Bv compiler option as an Additional Option on the compiler command line. This will show the verbose compiler version information in the build Output box. Just enter “-Bv” in the Project Properties > C/C++ > Command Line edit box.


1 Answers

The 'Details' page in Windows Explorer is pulling the information from unmanaged structures in the file, so you'll need to create an unmanaged version resource in order to fill that in.

  1. In Visual Studio, add a "Resource File (.rc)" to your project, if you don't already have one.
  2. In the resource file, add a new "Version" resource.
  3. Fill in your information.

I recommend that you maintain the various assembly attributes in your AssemblyInfo.cpp file as well. If you use reflection to get information about the assembly, it will use the stuff in AssemblyInfo.cpp, not in the version resource.

like image 114
David Yaw Avatar answered Oct 12 '22 11:10

David Yaw