• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 100
  • Last Modified:

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

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
gswitz
Asked:
gswitz
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
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
 
Daniel Van Der WerkenIndependent ConsultantCommented:
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
 
gswitzAuthor Commented:
Thanks, that should work.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now