我有一个针对.NET Framework 4.6.2的ASP.NET核心应用程序。
我在Microsoft.NETCore.App
文件中没有看到project.json
,当我尝试将一些关键的NuGet软件包从版本1.0.0升级到1.1.0时,我收到的错误表明依赖关系不可能是解决。
看起来我需要升级到.NET Core 1.1,但我仍然对这个.NET Core与.NET Framework业务感到困惑。
如果我的ASP.NET核心应用程序的目标是.NET Framework 4.6.2,我还是:
更新: 我正在下面添加我的project.json文件
{
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"dependencies": {
"BundlerMinifier.Core": "2.2.306",
"Microsoft.AspNetCore.Authentication": "1.0.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Authentication.Facebook": "1.0.0",
"Microsoft.AspNetCore.Authentication.Google": "1.0.0",
"Microsoft.AspNetCore.Authentication.OAuth": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.Abstractions": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
},
"frameworks": {
"net462": {
"dependencies": {
"MyClassLibrary1": {
"target": "project"
},
"MyClassLibrary2": {
"target": "project"
}
}
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
}
}
更新2: ClassLibrary1和ClassLibrary2项目没有project.json文件。这是他们的packages.config文件。
ClassLibrary1 packages.config文件:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net462" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net462" />
<package id="System.ComponentModel.Annotations" version="4.3.0" targetFramework="net462" />
</packages>
ClassLibrary2 packages.config文件:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net462" />
<package id="Microsoft.Azure.DocumentDB" version="1.11.3" targetFramework="net462" />
<package id="Microsoft.Azure.KeyVault.Core" version="2.0.4" targetFramework="net462" />
<package id="Microsoft.Data.Edm" version="5.8.1" targetFramework="net462" />
<package id="Microsoft.Data.OData" version="5.8.1" targetFramework="net462" />
<package id="Microsoft.Data.Services.Client" version="5.8.1" targetFramework="net462" />
<package id="Microsoft.Extensions.Configuration" version="1.1.0" targetFramework="net462" />
<package id="Microsoft.Extensions.Configuration.Abstractions" version="1.1.0" targetFramework="net462" />
<package id="Microsoft.Extensions.Configuration.FileExtensions" version="1.1.0" targetFramework="net462" />
<package id="Microsoft.Extensions.Configuration.Json" version="1.1.0" targetFramework="net462" />
<package id="Microsoft.Extensions.FileProviders.Abstractions" version="1.1.0" targetFramework="net462" />
<package id="Microsoft.Extensions.FileProviders.Physical" version="1.1.0" targetFramework="net462" />
<package id="Microsoft.Extensions.FileSystemGlobbing" version="1.1.0" targetFramework="net462" />
<package id="Microsoft.Extensions.Primitives" version="1.1.0" targetFramework="net462" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net462" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net462" />
<package id="NETStandard.Library" version="1.6.1" targetFramework="net462" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net462" />
<package id="Sendgrid" version="8.0.5" targetFramework="net462" />
<package id="SendGrid.CSharp.HTTP.Client" version="3.0.0" targetFramework="net462" />
<package id="StackExchange.Redis" version="1.2.0" targetFramework="net462" />
<package id="System.AppContext" version="4.3.0" targetFramework="net462" />
<package id="System.Collections" version="4.3.0" targetFramework="net462" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net462" />
<package id="System.Console" version="4.3.0" targetFramework="net462" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net462" />
<package id="System.Diagnostics.DiagnosticSource" version="4.3.0" targetFramework="net462" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net462" />
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net462" />
<package id="System.Globalization" version="4.3.0" targetFramework="net462" />
<package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net462" />
<package id="System.IO" version="4.3.0" targetFramework="net462" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net462" />
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net462" />
<package id="System.IO.FileSystem" version="4.3.0" targetFramework="net462" />
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net462" />
<package id="System.Linq" version="4.3.0" targetFramework="net462" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net462" />
<package id="System.Net.Http" version="4.3.0" targetFramework="net462" />
<package id="System.Net.Primitives" version="4.3.0" targetFramework="net462" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net462" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net462" />
<package id="System.Reflection" version="4.3.0" targetFramework="net462" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net462" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net462" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net462" />
<package id="System.Runtime" version="4.3.0" targetFramework="net462" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.3.0" targetFramework="net462" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net462" />
<package id="System.Runtime.Handles" version="4.3.0" targetFramework="net462" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net462" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net462" />
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net462" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net462" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net462" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net462" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net462" />
<package id="System.Spatial" version="5.8.1" targetFramework="net462" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net462" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net462" />
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net462" />
<package id="System.Threading" version="4.3.0" targetFramework="net462" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net462" />
<package id="System.Threading.Timer" version="4.3.0" targetFramework="net462" />
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net462" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net462" />
<package id="WindowsAzure.Storage" version="8.0.1" targetFramework="net462" />
</packages>
答案 0 :(得分:0)
如果您使用的所有依赖项也都针对相同的框架,那么您的ASP.NET核心应用程序可以定位多个框架。
如果您使用的任何依赖项不支持.NET Core,则会出现错误。通过使用导入可以减轻一些错误。
以下是project.json文件中的条目示例,该文件指定应为多个框架构建ASP.NET Core应用程序:
"frameworks": {
"netcoreapp1.1": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
}
},
"imports": [ "dnxcore50", "portable-net451+win8" ]
},
"net462": {}
}