Solved

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

Posted on 2015-02-20
3
92 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 40621146
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 20

Accepted Solution

by:
Daniel Van Der Werken earned 500 total points
ID: 40621318
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
ID: 40621328
Thanks, that should work.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

756 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