Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find .net framework of application?

I am working on scanner kind of application which takes different C# codebases as input.I want to know in which .net framework version(1.1/2.0/3.5/4.0) specific codebase is built.

Can anybody provide me code to check .net framework version of codebases? can i read codebase version from .csproj file ? If yes, please provide code for same.

Thanks,

Teena.

like image 563
Teena Avatar asked Jan 20 '23 12:01

Teena


2 Answers

Look for the TargetFrameworkVersion and RequiredTargetFramework attributes in the .csproj file: there's code here to open and parse the project file.

like image 112
stuartd Avatar answered Feb 28 '23 02:02

stuartd


Can anybody provide me code to check .net framework version of codebases? can i read codebase version from .csproj file ?

Use the Project class:

string projectFileName = ...
Project proj = new Project(projectFileName);
string version = proj.GetPropertyValue("TargetFrameworkVersion");
like image 33
Thomas Levesque Avatar answered Feb 28 '23 02:02

Thomas Levesque