开发者

How to find .net framework of application?

开发者 https://www.devze.com 2023-03-13 07:12 出处:网络
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) specificcodebase is built.

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 f开发者_JAVA百科rom .csproj file ? If yes, please provide code for same.

Thanks,

Teena.


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


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");


var document = XDocument.Load("ProjectName.csproj");
var targetFramework = document
    .Descendants(XName.Get("TargetFrameworkVersion", "http://schemas.microsoft.com/developer/msbuild/2003"))
    .First()
    .Value;


the cs proj file is an xml document

just open it and have a look you can parse it and work with it like any xml document.


steps for windows application:

1) Right click on project that you want to know framework version.

2) Click on “Properties” or press “ALT+ENTER”.

3) Now click on “Compile” tab from tree view.

4) Click on “Advance Compile Options..” appear at bottom.

5) It opens Settings pop up and from that you can find out “Target Framework”. From that you can also change framework of your application and save settings. That’s it.

You can also refer following image for faster review:

How to find .net framework of application?

How to find .net framework of application?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号