简体   繁体   中英

Target .NET Framework 2.0 (not .NET Core 2.0) with Visual Studio 2017

I want to contribute to Open Hardware Monitor , which uses .NET Framework 2.0 (again, it is not .NET Core 2.0).

When I clone the repo and open the solution file, Visual Studio 2017 says I have to download some sort of "targeting pack" in this url . However, I cannot find the option to download .NET Framework 2.0. (the minimum version is 3.5 SP1.)

How can I target .NET Framework 2.0 with Visual Studio 2017? I don't want to download and install older versions of Visual Studio.

First of all, you have to enable .NET Framework 3.5 in the "Windows Features" tab of the control panel, which includes .NET Framework 2.0. You won't be able to target those frameworks if you don't.

Then, you'll see in the project properties panel a "Target Framework" property, set it to .NET Framework 2.0.

I ended up on this page when I ran into a similar problem where I had created a new C# Project, but needed an older library to be able to reference it. The older library was a .Net Framework 2.0 project. Unbeknownst to me, if you create a new C# project and choose ".Net Standard" project, it is not the same thing as .Net Framework. I was thinking that I could just switch back the Target Framework version using the Target Framework dropdown in the Properties->Application tab, but couldn't find any .Net Framework version (much less the 2.0 Version I was looking for). It gave a confusing option to go and download other frameworks, and directed me to a page where other frameworks could be downloaded including other .Net Frameworks, but not the 2.0 version. My final solution was to create a completely new project and choose Class Library (.NET Framework) and from that I could choose the needed 2.0 Framework.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM