简体   繁体   中英

Can the “Windows Desktop Class Library” template be used to create a class library used by mutliple ASP.NET web applications?

I have a Visual Studio (2017) solution containing several C# ASP.NET Web Application projects (WebForms) targeting the 4.x .NET Framework. I am developing a class library that all of the ASP.NET projects can use, to avoid duplicating similar logic across multiple ASP.NET projects. The class library also needs to target the 4.x .NET Framework.

When attempting to create a new class library project, I see that the Windows Desktop Class Library (.NET Framework) project template allows me to choose the specific 4.x version I need.

But conceptually, linking a "Windows Desktop" Class Library in an ASP.NET project sounds odd to me.

My question is this: Is it safe/prudent/appropriate to use the "Windows Desktop Class Library" template for a class library that will be used by ASP.NET web application projects? Or is there some other more appropriate template or approach that would better suit this situation?

Yes, "Windows Desktop" -> "Class Library" is the right type of a project for a library to use with ASP.Net/ASP.Net MVC sites.

"Windows Desktop" is essentially "regular .Net as it was started in 2000" as opposing to Core, Standard or UWP variants. "Web" is grouping by type of project and somewhat confusing to be on the same level as variants of .Net… but that is how VS folks decided to group templates together.

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