.NET (standard, Core and Framework): Developing Cross Platform Applications
I have searched SO, but I find a lot of answers but not targeting my questions:
AS the definitions say:
In order to develop cross platform applications, I intend to create ASP.NET core applications (.NET) which might reference other class libraries that might use:
I assume that if I use any(standard or Core) my application will still support other OS.
In Some cases, I see people using traditional .NET Framework With .NET Standard in class library?
For instance, let's say I have a class library that has the project.json:
"dependencies": {
"Microsoft.Extensions.Caching.Abstractions": "1.0.0",
"Microsoft.Extensions.Options": "1.0.0",
"StackExchange.Redis.StrongName": "1.1.608",
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.5": { }
}
How is the dependency different from framework? and how is the project resolving the assemblies since the Standard Library is just a specification.
In this case, Is the application still cross platform when using .NET Framework?
Not really, a .Net Framework application won't run on .Net Core. But it might run on mono, which is available on Linux and Mac OS.
When Should I mix and use a combination (Standard , Core, NET)?
You should use .Net Standard for your libraries, if you can (ie as long as they don't have any framework-specific dependencies).
You use .Net Framework for your applications if they have .Net Framework-specific dependencies or if the application can be Windows-only.
You use .Net Core for your application if it needs to be cross-platform, or if you want to use newest APIs. (.Net Core generally updates faster then .Net Framework and also has preview versions.)
What is the best practices in using and mixing between frameworks?
I don't understand the question. You can't mix .Net Framework and .Net Core in the same application.
How to avoid any conflicts and build failures?
I don't think that's an answerable question, though I can offer some obvious advice:
EDIT:
How is the dependency different from framework?
"frameworks": { "netstandard1.5": { } }
means that the library is a .Net Standard 1.5 library and decides which frameworks it can be used from.
"dependencies": { "NETStandard.Library": "1.6.0" }
actually brings in the packages that are part of .Net Standard Library. It also means that the library can access all of .Net Standard Library, not just some subset of it.
How is the project resolving the assemblies since the Standard Library is just a specification?
The packages that NETStandard.Library
depends on are more than just a specification. For example, the package System.IO.Compression.ZipFile
contains:
ZipFile
for .Net Framework 4.6, which just forwards to the System.IO.Compression.FileSystem
framework assembly ZipFile
(To look inside packages yourself, I recommend NuGetPackageExplorer.)
链接地址: http://www.djcxy.com/p/81890.html