无法将 "WindowsAzure.Storage" 依赖项添加到 .Net Core (ASP.NET 5) class 库
Unable to add "WindowsAzure.Storage" dependency to .Net Core (ASP.NET 5) class library
我的项目解决方案是这样设置的,包含以下项目
MyProjectSolution.sln
MyProject.WebPI(Asp.net 5 WebAPI)
MyProject.Data(Asp.net 5 class libray)
MyProject.Domain(Asp.net 5 class libray)
我按照以下文章中列出的步骤操作
https://azure.microsoft.com/en-us/documentation/articles/vs-azure-tools-connected-services-storage/ and https://azure.microsoft.com/en-us/documentation/articles/vs-storage-aspnet5-getting-started-blobs/
这改变了我的 project.json 以包含此依赖项 "WindowsAzure.Storage": "4.3.2-preview"
但随后出现错误,指出 WindowsAzure.Storage 在 DNXCoreVersion=5.0
上不受支持
注意:
1) 我还尝试手动添加上述依赖项以检查它是否导致相同或不同的错误 - 没有变化。
2) 我尝试浏览到 sdks %Program Files%\Microsoft SDKs\Azure.NET SDK\\ref\ 的位置,但找不到它。附上我找到的dll的截图。
有具体的版本我可以试试吗?或者我错过了什么重要的东西吗?
谢谢!
{
"version": "1.0.0-*",
"description": "MyProject.Data Class Library",
"authors": [""],
"tags": [""],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"dnx451": {
/*These were added after I connected to the Azure Storage as seen in the article that did NOT exist before*/
"dependencies": {
"Microsoft.Data.Edm": "5.6.3",
"Microsoft.Data.OData": "5.6.3",
"Microsoft.Data.Services.Client": "5.6.3",
"System.Spatial": "5.6.3"
}
},
"dnxcore50": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516",
"System.IO": "4.0.11-beta-23516"
}
}
},
"dependencies": {
"MyProject.Domain": "1.0.0-*",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
/*This was added after I connected to the Azure Storage as seen in the article that did not exist before*/
"WindowsAzure.Storage": "4.3.2-preview",
}
}
这是因为 Windows Azure Storage 4.3.2-preview nuget 是一个非常旧的版本,发布于 2014 年 11 月,与当前版本不兼容ASP.NET核心。
http://www.nuget.org/packages/WindowsAzure.Storage/4.3.2-preview
您可以参考下面的 Windows Azure 存储 nuget 包的发行说明,以获取与您正在使用的目标 ASP.NET 核心兼容的 version/revision。
希望对您有所帮助!
使用 7.0.2-preview
https://www.nuget.org/packages/WindowsAzure.Storage/7.0.2-preview
根据更新日志,更新为使用 .Net Core 1.0 的 RC2 版本。
7.1.1-preview 已针对 .Net Core 1.0 的 RTM 版本进行了更新,但目前似乎无法通过 NuGet 获得。 (NuGet page 说 "The owner has unlisted this package. This could mean that the package is deprecated or shouldn't be used anymore.")
另外,请注意,这包含对当前没有 .Net Core 版本的 ODataLib 包的依赖项。请参阅 this note for WindowsAzure.Storage readme 其中指出:
The ODataLib packages currently do not support "netstandard1.6" or "netcoreapp1.0" frameworks in projects depending on the current relase of Dotnet CoreCLR. Thus, you may encounter failures while trying to restore the ODataLib dependencies for one of the targeted frameworks mentioned above. Until the support is added, if you run into this, you can use the imports statement within the framework node of your project.json file to specify to NuGet that it can restore the packages targeting the framework within the "imports" statement as shown below:
"imports": [
"dnxcore50",
"portable-net451+win8"
]
编辑: 使用 WindowsAzure.Storage 7.1.3-preview
我的项目解决方案是这样设置的,包含以下项目
MyProjectSolution.sln
MyProject.WebPI(Asp.net 5 WebAPI)
MyProject.Data(Asp.net 5 class libray)
MyProject.Domain(Asp.net 5 class libray)
我按照以下文章中列出的步骤操作 https://azure.microsoft.com/en-us/documentation/articles/vs-azure-tools-connected-services-storage/ and https://azure.microsoft.com/en-us/documentation/articles/vs-storage-aspnet5-getting-started-blobs/ 这改变了我的 project.json 以包含此依赖项 "WindowsAzure.Storage": "4.3.2-preview"
但随后出现错误,指出 WindowsAzure.Storage 在 DNXCoreVersion=5.0
上不受支持注意: 1) 我还尝试手动添加上述依赖项以检查它是否导致相同或不同的错误 - 没有变化。
2) 我尝试浏览到 sdks %Program Files%\Microsoft SDKs\Azure.NET SDK\\ref\ 的位置,但找不到它。附上我找到的dll的截图。
有具体的版本我可以试试吗?或者我错过了什么重要的东西吗?
谢谢!
{
"version": "1.0.0-*",
"description": "MyProject.Data Class Library",
"authors": [""],
"tags": [""],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"dnx451": {
/*These were added after I connected to the Azure Storage as seen in the article that did NOT exist before*/
"dependencies": {
"Microsoft.Data.Edm": "5.6.3",
"Microsoft.Data.OData": "5.6.3",
"Microsoft.Data.Services.Client": "5.6.3",
"System.Spatial": "5.6.3"
}
},
"dnxcore50": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516",
"System.IO": "4.0.11-beta-23516"
}
}
},
"dependencies": {
"MyProject.Domain": "1.0.0-*",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
/*This was added after I connected to the Azure Storage as seen in the article that did not exist before*/
"WindowsAzure.Storage": "4.3.2-preview",
}
}
这是因为 Windows Azure Storage 4.3.2-preview nuget 是一个非常旧的版本,发布于 2014 年 11 月,与当前版本不兼容ASP.NET核心。
http://www.nuget.org/packages/WindowsAzure.Storage/4.3.2-preview
您可以参考下面的 Windows Azure 存储 nuget 包的发行说明,以获取与您正在使用的目标 ASP.NET 核心兼容的 version/revision。
希望对您有所帮助!
使用 7.0.2-preview
https://www.nuget.org/packages/WindowsAzure.Storage/7.0.2-preview
根据更新日志,更新为使用 .Net Core 1.0 的 RC2 版本。
7.1.1-preview 已针对 .Net Core 1.0 的 RTM 版本进行了更新,但目前似乎无法通过 NuGet 获得。 (NuGet page 说 "The owner has unlisted this package. This could mean that the package is deprecated or shouldn't be used anymore.")
另外,请注意,这包含对当前没有 .Net Core 版本的 ODataLib 包的依赖项。请参阅 this note for WindowsAzure.Storage readme 其中指出:
The ODataLib packages currently do not support "netstandard1.6" or "netcoreapp1.0" frameworks in projects depending on the current relase of Dotnet CoreCLR. Thus, you may encounter failures while trying to restore the ODataLib dependencies for one of the targeted frameworks mentioned above. Until the support is added, if you run into this, you can use the imports statement within the framework node of your project.json file to specify to NuGet that it can restore the packages targeting the framework within the "imports" statement as shown below:
"imports": [ "dnxcore50", "portable-net451+win8" ]
编辑: 使用 WindowsAzure.Storage 7.1.3-preview