Solved

Assembly.GetExecutingAssembly() for an assembly other than current executing

Posted on 2015-02-20
3
84 Views
Last Modified: 2015-02-20
I'm in a common assembly and I need the version number off the web assembly. I prefer not to have to new anything up to get it.

Is there a right way to do this?

I'm interested in keeping the auto incrementing version of the web project in sync with the auto incrementing version of the common project. I prefer to not have to manually increment in the AssemblyInfo.cs for both projects. I prefer to not have to reference the web assembly from the common assembly in order to get the version for the web assembly.
0
Comment
Question by:gswitz
3 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
Comment Utility
You probably want GetCallingAssembly() which will return the Assembly that invoked the method call, rather than the assembly in which the called method resides.
0
 
LVL 19

Accepted Solution

by:
Daniel Van Der Werken earned 500 total points
Comment Utility
Not 100% sure what you're trying to do or not trying to do. Here's how I'd get the version of any assembly:

FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(filePath);

Open in new window


Grab the version and then add it back into the AssemblyInfo.cs file prior to your build. Make that a pre-build step.
0
 

Author Closing Comment

by:gswitz
Comment Utility
Thanks, that should work.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now