我有一個針對.NET Framework 4.6.2的ASP.NET Core應用程序。.NET Framework的Microsoft.NETCore.App
我在我的project.json
文件中看不到Microsoft.NETCore.App
,當我嘗試將某些關鍵NuGet包從版本1.0.0升級到1.1.0時,出現錯誤,指出無法解析依賴關係。
看起來我需要升級到.NET Core 1.1,但我仍然對這個.NET Core和.NET Framework業務感到困惑。
如果我的ASP.NET核心的應用定位的.NET Framework 4.6.2,我還是:
- 按照下面的文章升級到.NET 1.1的核心? https://blogs.msdn.microsoft.com/dotnet/2016/11/16/announcing-net-core-1-1/
- 在我的項目上安裝Microsoft.NETCore.App 1.1?
更新: 我添加下面
{
"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我project.json文件: 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>
我的應用程序及其所有依賴。那麼我應該得出結論:我不應該在框架下使用netcoreapp1.1?這一切都開始了,因爲我試圖升級其中一個NuGet軟件包並出現錯誤。我似乎無法從1.0.0升級到1.1.0。所以得出結論,我需要將整個ASP.NET Core應用程序升級到1.1。 – Sam
只需將我的project.json文件添加到原始文章。當我嘗試將「Microsoft.AspNetCore.Authentication」:「1.0.0」升級到版本1.1.0時,出現錯誤,表示依賴項無法解析。任何從1.0.0升級到1.1.0的NuGet升級都會出現同樣的錯誤。這就是爲什麼我總結說我需要將應用程序升級到Core 1.1,正如我在原文中鏈接的文章中所述。 – Sam
你可以發佈你的MyClassLibrary1和MyClassLibrary2項目的project.json文件的內容嗎? –