本文介绍了仅适用于Windows x64的ASP.NET Core应用程序(.NET Framework)在project.assets.json中出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用VS 2017简化ASP.NET Core Web应用程序(.NET Framework)应用程序中的配置.

I want to simplify my configuration in my ASP.NET Core Web Application (.NET Framework) application using VS 2017.

我已经知道我的网站将在x64环境和.NET 4.6.2的Windows/IIS下运行.在可预见的和不可预见的将来,此应用程序将无法使用从开发到生产的任何其他环境.

I already know that my website will be running under Windows/IIS in x64 environment and .NET 4.6.2. There is no chance in the foreseen and unforeseen future for this application to use any other environment from the dev to production.

因此,我只需要Debug x64和Release x64模式. (不需要任何CPU和x86!),所以我继续从项目中删除了所有其他配置.

So, I only need Debug x64 and Release x64 modes only. (AnyCPU and x86 are not needed!), so I went ahead and removed all other configuration from the project.

现在,在编译时,出现以下错误:

Now, upon compilation, I am getting the following error:

确保您 已经为TargetFramework ='net462'恢复了该项目,并且 RuntimeIdentifier ='win7-x64'. MD.Website C:\ Program档案 (x86)\ Microsoft Visual Studio \ 2017 \ Enterprise \ MSBuild \ Sdks \ Microsoft.NET.Sdk \ build \ Microsoft.NET.Sdk.targets

Ensure you have restored this project for TargetFramework='net462' and RuntimeIdentifier='win7-x64'. MD.Website C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets

我正在Windows 7上进行开发,不确定如何解决此问题.有什么主意吗?

I am developing on Windows 7, I am not sure how to fix this one. Any idea?

推荐答案

由于某些原因,我的.csproj文件中的<TargetFramework>是单数.我添加了一个"s",它变成了"TargetFramework s ",可以正常工作:

For some reason <TargetFramework> in my .csproj file was singular. I added an "s" and it became "TargetFrameworks", which worked:

  <PropertyGroup>
    <TargetFrameworks>net462</TargetFrameworks>
    <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
  </PropertyGroup>

这篇关于仅适用于Windows x64的ASP.NET Core应用程序(.NET Framework)在project.assets.json中出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 02:20