dotnet 恢复 - "not compatible with win7"

dotnet restore - "not compatible with win7"

我正在尝试在一个 dotnet core 项目上使用 dotnet restore,它似乎工作正常,直到最后,我突然收到这条奇怪的消息。

error: System.IO.IsolatedStorage 4.0.1-beta-23516 provides a compile-time reference assembly for System.IO.IsolatedStorage on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x64.

error: System.IO.IsolatedStorage 4.0.1-beta-23516 provides a compile-time reference assembly for System.IO.IsolatedStorage on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win7-x86.

我到处搜索这个问题的答案,但我完全迷路了。我在下面发布了我的 project.json 以及我的 nuget.config 供稿以供参考。

nuget.config 供稿

<packageSources>
    <add key="aspnet-core" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
    <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</packageSources>

project.json

{
    "webroot": "wwwroot",
    "version": "1.0.0-*",
    "dependencies": {

        "Microsoft.NETCore.Platforms": "1.0.1-*",
        "Microsoft.AspNetCore.Diagnostics": "1.0.0-*",
        "Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*",
        "Microsoft.AspNetCore.Mvc": "1.0.0-*",
        "Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0-*",
        "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*",
        "Microsoft.AspNetCore.StaticFiles": "1.0.0-*",
        "Microsoft.Extensions.Configuration.Json": "1.0.0-*",
        "Microsoft.Extensions.Logging.Console": "1.0.0-*",
        "Microsoft.AspNetCore.Identity": "1.0.0-*"
    },
    "frameworks": {
        "dnx451": {
            "dependencies": {
                "Microsoft.AspNetCore.Mvc.Dnx": "1.0.0-*"
            }
        },
        "net451": { },
        "dnxcore50": {
            "imports": "portable-net451+win7+win8",
            "dependencies": {
                "NETStandard.Library": "1.0.0-*"
            }
        }
    },

    "publishExclude": [
        "node_modules",
        "bower_components",
        "**.xproj",
        "**.user",
        "**.vspscc"
    ],
    "exclude": [
        "wwwroot",
        "node_modules",
        "bower_components"
    ]
}

更新

我已经清除了以下目录;

%userprofile%\.nuget %userprofile%\.dnx\packages %localappdata%\NuGet\v3-cache

然后我使用以下命令从 dotnet/cli/ 存储库 运行 /scripts/obtain/ 的更新程序...

.\install.ps1 -channel beta

然后我回去对我的项目做了 dotnet restore,它确实说它有效,但我收到以下警告。

warn : Detected package downgrade: Microsoft.Dnx.Compilation.CSharp.Abstractions from 1.0.0-rc2-16553 to 1.0.0-rc2-16552

我能做些什么吗?

您的项目看起来完全没问题,并且可以无错地恢复:

log  : Restore completed in 69790ms.
NuGet Config files used:
    D:\Temp\tempmvc\NuGet.Config
    C:\Users\victor\AppData\Roaming\NuGet\NuGet.Config
Feeds used:
   https://www.myget.org/F/aspnetcidev/api/v3/index.json
   https://api.nuget.org/v3/index.json
   https://www.nuget.org/api/v2/
Installed:
    279 package(s) to D:\Temp\tempmvc\project.json

您可能在包缓存中有一些来自其他提要的较新包,或者您可能使用了错误版本的 dotnet cli。确保从 beta 频道安装 CLI。

清除缓存删除:

  • %userprofile%\.nuget
  • %localappdata%\NuGet\v3-cache

要从测试版源安装 CLI,运行 来自 here 的脚本:

install.ps1 -channel beta

以上答案对于 install.ps1 声明不再有效,但我不能在那里发表评论:

脚本名称现在是 dotnet-install.ps1,频道参数现在是:futurepreview产量产量最稳定

dotnet-install.ps1 -channel production

编辑:目前 -channel beta 仍然有效并且 production 尚不存在,尽管已在源代码中列出代码 :) 预发布软件的乐趣...