By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,652 Members | 1,473 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,652 IT Pros & Developers. It's quick & easy.

Sync file version with assembly version

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a

"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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.