Search code examples
asp.net-coresemantic-versioning

Read assembly version of class library Project from .netCore web app project


I have 4 web applications based on .net core. all of them call a business logic layer (class library)

i want my version to get updated on all 4 web applications.

I have tried to make a static class on my business logic layer. and on this class i have a property that gets the version as the following:

Assembly.GetEnteryAssembly().GetName().Version

i tried to call this static class from one of the applications, sadly it brings the version of the web application instead of the class library version.

I want a code that always brings me the version of class library regardless from where it is called.


Solution

  • You can use Assembly.GetAssembly(typeof(YourClass)), being YourClass any class within desired assembly.