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:\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
I am developing on Windows 7, I am not sure how to fix this one. Any idea?
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>
I didn't change my
TargetFramework, I ran in the Package Manager Console the command:
And it worked! (I'm using VS2017 and I'm doing a .net core application pointing to .net framework)
I had manually changed mine from x86 to x64. In this case, just restoring the packages from Visual Studio would not work but closing Visual Studio, deleting the project.assets.json, re-starting Visual Studio and re-building the project worked for me. I left
nuget restore ... may also have worked.