微软现在在其.NET系列中拥有.NET Core,.NET Framework和Xamarin(Mono).
这里似乎有很多重叠.这些类型的.NET有什么区别?我应该何时选择在我的项目中使用.NET Core,而不是.NET Framework或Xamarin?
使用ASP.NET Core 1.0版本,可以根据此处的文档在 .NET Core或完整的 .NET Framework 上运行.我试图理解为什么选择ASP.NET Core +完整的.NET Framework的后一种选择?
我理解完整的.NET Framework和.NET Core之间的区别.但是,如果我想使用完整的.NET Framework,为什么不使用ASP.NET 4.6呢?我认为这个想法是在.NET Core上使用ASP.NET Core的1-2个冲击,允许一系列的好处,如跨平台部署,模块化,部署到Docker容器的能力,性能等.没有.NET Core我不喜欢不相信该列表上的任何内容仍然有效,那么完整的.NET框架+ ASP.NET Core的用例是什么?在没有.NET Core的情况下,ASP.NET Core自身还能提供什么?
我正在构建导入.Net Framework 4.6.1项目类库的.Net Core 2.0 Web应用程序。该解决方案可以正确构建,但是,当达到以下功能时,我收到以下错误:
System.TypeLoadException: Could not load type 'Microsoft.VisualBasic.Information' from assembly 'Microsoft.VisualBasic, Version=10.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Run Code Online (Sandbox Code Playgroud)
我在以下位置找到了Microsoft.VisualBasic.dll:
C:\ Windows \ Microsoft.NET \ assembly \ GAC_MSIL \ Microsoft.VisualBasic \ v4.0_10.0.0.0__b03f5f7f11d50a3a。
尝试通过“项目”->“添加引用”进行添加并浏览时,该引用不会保持选中状态。我可以检查它,但是当我返回到引用管理器时,再次取消选中DLL。
万一重要,该功能将使用反射,如下所示(以导入方式显示):
Imports System.Data.SqlClient
Imports System.Reflection
Imports Microsoft.Win32
Shared Function GetContentCostFieldMapping(Optional ByVal busGrp As String = Nothing, Optional ByVal program As String = Nothing) As CostFieldMapping
Dim _conn As SqlConnection = Nothing
Dim _row As CostFieldMapping = New CostFieldMapping
Try
_conn = New SqlConnection(_sqlDB)
_conn.Open()
Dim _cmd As …Run Code Online (Sandbox Code Playgroud) 我试图将完整框架(4.6.1)上开发的ASP.NET Core应用程序发布到IIS.现在代码只是使用Visual Studio"ASP.NET Core(.NET Framework)选项创建的基本模板代码.代码编译得很好但是当我将它发布到本地IIS时,它无法启动.我得到的错误就像
Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.Extensions.PlatformAbstractions.PlatformServices' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Reflection.TypeExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
at Microsoft.Extensions.PlatformAbstractions.ApplicationEnvironment.GetEntryAssembly()
at Microsoft.Extensions.PlatformAbstractions.ApplicationEnvironment..ctor()
at Microsoft.Extensions.PlatformAbstractions.PlatformServices..ctor()
at Microsoft.Extensions.PlatformAbstractions.PlatformServices..cctor()
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildHostingServices()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
Run Code Online (Sandbox Code Playgroud)
我的project.json看起来像这样
{
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0", …Run Code Online (Sandbox Code Playgroud)