如何在Visual Studio中设置C ++ / CLI项目的版本? [英] How do you set the version of a C++/CLI project in Visual Studio?

查看:554
本文介绍了如何在Visual Studio中设置C ++ / CLI项目的版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的C ++ / CLI项目有一个AssemblyInfo.cpp。我在C ++ / CLI项目中使用了Visual Studio 2012中的C ++ Native库。我设置所有的字段,其中包括一个AssemblyVersionAttribute。但是,当我在Windows资源管理器中构建我的项目并检查其属性时,版本信息为空。



这是我第一个C ++ / CLI项目,



如何设置C ++ / CLI的版本项目?




$ b

我将添加我的AssemblyInfo.cpp的内容。

 使用命名空间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(版权©2014)];
[assembly:AssemblyTrademarkAttribute(Inc)];
[assembly:AssemblyCultureAttribute()];
[assembly:AssemblyVersionAttribute(3.9.0)];
[assembly:ComVisible(false)];
[assembly:CLSCompliantAttribute(true)];
[assembly:SecurityPermission(SecurityAction :: RequestMinimum,UnmanagedCode = true)];


解决方案

Windows资源管理器中的


  1. 在视觉效果中,您需要创建一个未管理的版本资源Studio中,如果您还没有资源文件(.rc),请将其添加到您的项目中。

  2. 在资源文件中,添加一个新的版本资源。

  3. 填写您的信息。

我建议您在AssemblyInfo.cpp文件中维护各种程序集属性。如果你使用反射来获取关于程序集的信息,它将使用AssemblyInfo.cpp中的东西,而不是在版本资源中。


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)];

解决方案

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.

这篇关于如何在Visual Studio中设置C ++ / CLI项目的版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆