c# - 适用于 Windows x64 的 ASP.NET Core 应用程序(.NET Framework)仅在 project.assets.json 中出错

标签 c# msbuild asp.net-core visual-studio-2017 project.json

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

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

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

现在,在编译时,我收到以下错误:

'C:\Projects\MyProject\My.Website\obj\project.assets.json' doesn't have a target for '.NETFramework,Version=v4.6.2/win7-x64'.

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 上开发,我不确定如何解决这个问题。有什么想法吗?

最佳答案

出于某种原因<TargetFramework>在我的 .csproj文件是单一的。我添加了一个“s”,它变成了“TargetFrameworks”,它起作用了:

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

关于c# - 适用于 Windows x64 的 ASP.NET Core 应用程序(.NET Framework)仅在 project.assets.json 中出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42842443/

相关文章:

visual-studio - bower.json 中的依赖项错误/语法错误

msbuild - TeamCity 表示在 MSBuild 步骤中使用 "Build Parameters"而不是 "/property:"。这意味着什么?

asp.net-core - 在 dotnet.exe 下运行时,IServerAddressesFeature 地址为空

c# - FFMPEG 将音轨连接到更长的视频轨道时,音频循环

c# - SEHException Kinect V2

c# - .NET Core - 构建项目指定 ReferencePath

compiler-construction - 在Visual Studio 2013中写入输出构建 Pane +错误列表,无需双击即可使用msbuild/new进程双击条目以出错

entity-framework - 从数据库更新模型 EF Core/.NET Core

c# - 使用 Ninject Dependency Creator 和 Event Broker 进行生命周期管理

c# - 在 C# 中从列表 <> 中删除对象