更新到 Visual Studio 2017 v15.8.2 后发布错误

Publishing error after updating to Visual Studio 2017 v15.8.2

上周,我的代码运行完美。现在,在下载并安装更新“15.8.2”后,当我尝试发布我的应用程序时,最后一步失败了。我的意思是,虽然构建过程没有问题,但发布过程返回以下错误:

"NETSDK1061: The project was restored using Microsoft.NETCore.App version 2.1.3, but with current settings, version 2.1.3-servicing-26724-03 would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection.".

注意:如果我移动到另一台装有 Vs2017 (15.8.1) 的 PC,一切都会按预期进行。

请不要将此问题标记为重复,因为它不是。我已经阅读了所有 post、博客和答案,但其中 none 提供了真正的解决方案。我没有将任何包升级到 2.1.2 或 2.1.3,我所有的包都引用 2.1.1,无一例外。我已经仔细检查了我所有的配置,一切似乎都没有问题,我已经遵循了所有的指导方针,但似乎没有什么是真正的解决方案。

注意:我的发布设置如下:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <WebPublishMethod>FileSystem</WebPublishMethod>
        <PublishProvider>FileSystem</PublishProvider>
        <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
        <LastUsedPlatform>Any CPU</LastUsedPlatform>
        <SiteUrlToLaunchAfterPublish />
        <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
        <ExcludeApp_Data>False</ExcludeApp_Data>
        <ProjectGuid>73d9d7f6-a8ff-4543-99e0-6af66bba4509</ProjectGuid>
        <publishUrl>bin\Release\netcoreapp2.1\publish\</publishUrl>
        <DeleteExistingFiles>True</DeleteExistingFiles>
        <TargetFramework>netcoreapp2.1</TargetFramework>
        <SelfContained>false</SelfContained>
        <_IsPortable>true</_IsPortable>
        <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    </PropertyGroup>
</Project>

如您所见,我的部署不是独立的。它依赖于框架

卸载 Microsoft .NET Core SDK 2.1.401 (x64) 然后重新安装。

这是一个bug in 15.8.2

您可以下载 Core SDK 重新安装 here