问题描述
我想使用 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 模式.(不需要 AnyCPU 和 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:
'C:ProjectsMyProjectMy.Websiteobjproject.assets.json' 没有有一个.NETFramework,Version=v4.6.2/win7-x64"的目标.
'C:ProjectsMyProjectMy.Websiteobjproject.assets.json' doesn't have a target for '.NETFramework,Version=v4.6.2/win7-x64'.
确保你已为 TargetFramework='net462' 恢复了此项目,并且运行时标识符='win7-x64'.MD.Website C:Program Files(x86)微软视觉Studio2017EnterpriseMSBuildSdksMicrosoft.NET.SdkuildMicrosoft.NET.Sdk.targets
Ensure you have restored this project for TargetFramework='net462' and RuntimeIdentifier='win7-x64'. MD.Website C:Program Files (x86)Microsoft Visual Studio2017EnterpriseMSBuildSdksMicrosoft.NET.SdkuildMicrosoft.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",它变成了TargetFrameworks",它起作用了:
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>
这篇关于ASP.NET Core Application (.NET Framework) for Windows x64 only error in project.assets.json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!