Dawid
Dawid

Reputation: 395

Print the EntityFramework Version at runtime

Is there a way to get the version of EF at runtime? Something similar to

Console.WriteLine(Environment.Version);

will return

4.0.30319.18034

Upvotes: 4

Views: 84

Answers (2)

Bala R
Bala R

Reputation: 108937

Extending Alexei's idea, you can do

string version = typeof(DbSet).Assembly.GetName().Version.ToString();

Upvotes: 3

Alexei Levenkov
Alexei Levenkov

Reputation: 100527

Print "version" of assembly for any type from the framework you are interested in:

Console.Write( typeof(String).Assembly.GetName().Version);

Upvotes: 1

Related Questions