473,750 Members | 2,541 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sync file version with assembly version

Hi all,

I have a C++/CLI project (VS 2005) that produces a DLL that exports C bindings.
Internally, this DLL contains routines compiled with /clr.

I notice that my DLL doesn't have a version resource. I assume that, unlike C#
and VB, C++ doesn't automatically generate a version resource. Is there any way
to make this happen? In particular, I don't want to have to manually update the
file version in the version resource to keep it in sync with the AssemblyVersion
attribute.

TIA - Bob
Jun 27 '08 #1
4 3179
Hi Bob,
You can simply add a version resource in your C++/CLI project. Please refer
to the following steps:
In Solution Explorer, expand Resource Files, double click app.rc, right
click your app.rc folder and click Add Resource..., select Version and
click New.
Then you can change the version number.

Hope this helps. Please feel free to let me know if you have any other
questions or concerns. Have a nice day!

Best regards,
Charles Wang
Microsoft Online Community Support
=============== =============== =============== ==============
Delighting our customers is our #1 priority. We welcome your
comments and suggestions about how we can improve the
support we provide to you. Please feel free to let my manager
know what you think of the level of service provided. You can
send feedback directly to my manager at: ms****@microsof t.com.
=============== =============== =============== ==============
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for
non-urgent issues where an initial response from the community
or a Microsoft Support Engineer within 1 business day is acceptable.
Please note that each follow up response may take approximately
2 business days as the support professional working with you may
need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by
contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== ===============
This posting is provided "AS IS" with no warranties, and confers no rights.
=============== =============== =============== ============

Jun 27 '08 #2
No, I'm not asking how to create a version resource. I'm asking if there is
some way to automatically synchronize the file version in the version
resource with the assembly version, which is specified by the
AssemblyVersion attribute. In other .Net languages (VB and C#), you don't
deal directly with the version resource. The compiler creates a version
resource for you, using assembly attributes to fill in the various resource
values (file version, description, copyright, etc.). As near as I can tell,
in C++ I need to maintain these values in two places (the version resource
and AssemblyInfo.cp p), and I need to manually ensure that the values are the
same in both places.

Let me ask the question a little bit differently: I have a bunch of
projects (most in VB, some in C++) that I build at the same time. When I
build them, I want them all to have the same assembly and file version
strings. I have a string constant in one of my assemblies, defined (in VB)
as:

Public Class Version
Public Const AssemblyVersion = "1.2.3.4"
End Class

In all of my projects (both VB and C++) I use that constant to set the
assembly version. In C++, my AssemblyInfo.cp p contains something like this:

[AssemblyVersion (MyNamespace::V ersion::Assembl yVersion)]

In VB, that's all I need to do, and the resultant executable gets a version
resource with the file version equal to the assembly version. But in C++ I
apparently need to manually create an edit a version resource. But it's not
practical for me to manually update the version resource when the assembly
version changes. Often as not I'll make a change to some other project and
bump the assembly versions as a result. In that scenario, I never even
touch the C++ project, much less fiddle with its version resource.

Jun 27 '08 #3

"Bob Altman" <rd*@nospam.nos pamwrote in message
news:er******** ******@TK2MSFTN GP06.phx.gbl...
No, I'm not asking how to create a version resource. I'm asking if there
is some way to automatically synchronize the file version in the version
resource with the assembly version, which is specified by the
AssemblyVersion attribute. In other .Net languages (VB and C#), you don't
deal directly with the version resource. The compiler creates a version
resource for you, using assembly attributes to fill in the various
resource values (file version, description, copyright, etc.). As near as
I can tell, in C++ I need to maintain these values in two places (the
version resource and AssemblyInfo.cp p), and I need to manually ensure that
the values are the same in both places.
You could probably use a #define to accomplish this.
>
Let me ask the question a little bit differently: I have a bunch of
projects (most in VB, some in C++) that I build at the same time. When I
build them, I want them all to have the same assembly and file version
strings. I have a string constant in one of my assemblies, defined (in
VB) as:

Public Class Version
Public Const AssemblyVersion = "1.2.3.4"
End Class

In all of my projects (both VB and C++) I use that constant to set the
assembly version. In C++, my AssemblyInfo.cp p contains something like
this:

[AssemblyVersion (MyNamespace::V ersion::Assembl yVersion)]

In VB, that's all I need to do, and the resultant executable gets a
version resource with the file version equal to the assembly version. But
in C++ I apparently need to manually create an edit a version resource.
But it's not practical for me to manually update the version resource when
the assembly version changes. Often as not I'll make a change to some
other project and bump the assembly versions as a result. In that
scenario, I never even touch the C++ project, much less fiddle with its
version resource.
If you need the version from some other assembly, I guess you'd need to
define a pre-build step that runs a simple tool that uses reflection to
retrieve the value, and then writes a file which you'd #include in your main
..rc file.

Jun 27 '08 #4
Yes, it is a good idea to do so. If you have any other questions or
concerns, please feel free to let us know.

Have a nice day!

Best regards,
Charles Wang
Microsoft Online Community Support
=============== =============== =============== ============
Delighting our customers is our #1 priority. We welcome your
comments and suggestions about how we can improve the
support we provide to you. Please feel free to let my manager
know what you think of the level of service provided. You can
send feedback directly to my manager at: ms****@microsof t.com.
=============== =============== =============== ============
This posting is provided "AS IS" with no warranties, and confers no rights.
=============== =============== =============== ============

Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
20898
by: Peter Blum | last post by:
I have built an assembly (dll) from which I expect third parties to subclass. As a result, when my assembly has a version change, it will cause any third party assembly based on it to break unless I establish a Publisher Policy file. So I have that. I have built a Windows app for the same product. This app prompts the user for a path to a third party assembly that depends on my assembly. It opens the third party assembly (Assembly.Load)...
3
12181
by: Michael Bøcker-Larsen | last post by:
Hi I'v been stuck on this problem for ages now. I have found that I'm not the only one with this problem, by looking through the different newsgroups. Hope you can help me! I know there is a lot of information, but if you need more (e.g. the code) please write michael@mblarsen.dk. The problem is this error messages (the code is build just fine; no errors):
4
1284
by: moondaddy | last post by:
How do I get all my assemblies to have the same build number? -- moondaddy@nospam.nospam
5
12098
by: Laurence | last post by:
In VS.2005 using VB.NET There are two versions on every project, The Assembly Version and the File Version. Why are there two different versions? As far as I can tell, there is not need for two versions. The assembly is the file, isn't it?
8
8862
by: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post by:
Hi; I copied a new set of files over to my ASP.NET dir (and subdirs) on our test server. This replaced every file for the app. When I first then tried to bring it up, I got the below error. After I bounced IIS, then it worked fine. log4net.dll is in the Bin directory. What is going on here - this makes no sense to me.
4
1876
by: mcterborg | last post by:
Hello everyone, here is what I want to do. I have a ATI video card and it allows me to setup profiles for monitor configurations and so forth. The shortcut to activate one of these profiles looks like this: "C:\Program Files\ATI Technologies\ATI.ACE\CLI.exe" Load profilename="Just Monitor" Here is one example of how I've tried to do it:
0
1191
by: DNB | last post by:
One of our web application suddenly stopped working. After doing some investigation I did find that following section has been added to web.config file. After removing this section it was working again. We could not figure out who added this?
1
8339
by: Steve Wofford | last post by:
I am recieving the following. This happens when I moved it from my development system to our production SBS 2003 w/ latest .net frameworks and service packs . I developed under XPSP2 and VS2008. The error is pointing to the Web.Config of my application. System.Data.Entity was missing from the server, but was on the dev system. I tried to add, but didnt help: C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5
4
3346
by: nightscorpion | last post by:
Hello Gurus, i implemented the OpenFileDialog in my Windows Form Applications and it worked perfectly fine.However when it was run on a remote desktop i got the below error . rt now im not sure where the problem is . is it something to do with any dll file which i need to include. if yes could u suggest me which dll files are involved in the open file dialog? thank u in advance See the end of this message for...
0
9001
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8838
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9583
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
6808
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4716
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4888
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.