Frage

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)];
War es hilfreich?

Lösung

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.

Andere Tipps

There are two attributes; an AssemblyVersion attribute and an AssemblyFileVersion attribute. With the C# compiler, the file version will track the AssemblyVersion if an AssemblyFileVersion is not supplied. I can't recall if the C++/CLI compiler behaves differently, but it certainly is worth a shot to try AssemblyFileVersion.

You can modify the VS_VERSION_INFO file inside the folder \app.rc\Version. You may use the Resource Visualizzation IDE to display this information file.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top