473,385 Members | 1,325 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 3147
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****@microsoft.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.cpp), 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.cpp contains something like this:

[AssemblyVersion(MyNamespace::Version::AssemblyVers ion)]

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.nospamwrote in message
news:er**************@TK2MSFTNGP06.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.cpp), 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.cpp contains something like
this:

[AssemblyVersion(MyNamespace::Version::AssemblyVers ion)]

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****@microsoft.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
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...
3
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...
4
by: moondaddy | last post by:
How do I get all my assemblies to have the same build number? -- moondaddy@nospam.nospam
5
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...
8
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. ...
4
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...
0
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...
1
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. ...
4
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 . ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.