Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
251 views
in Technique[技术] by (71.8m points)

c# - ASP.NET Core Application (.NET Framework) for Windows x64 only error in project.assets.json

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

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.

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' 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 Studio2017EnterpriseMSBuildSdksMicrosoft.NET.SdkuildMicrosoft.NET.Sdk.targets

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...