Unable to build .Net core 1.1 project with vs 2017 and .net core 2.0 - asp.net-core-1.1

I am fairly new to the .net world and not sure what I did wrong.
I am trying to build existing .net core project with core 2.0 .
Steps that i performed
Upgraded/Downloaded .net core sdk 2.0
downloaded vs2017 v15.2
tried to open repository with vs2017 ( which opens with erros like "Predefined type int32 is not defined or imported" , for every datatype)
build the project , this fails with errors as below
tried multiple things like :
uninstall nugget package and reinstall
Uninstall all .net core version apart from 2.0
cleared nugget package catche
closing reopening vs multiple times
tried to create new project ( which works fine )
Can someone help , 1 more thing is with same repository and SDK and VS2017 it works fine on other system ( has to be issue with my local system ).

Identified the issue and below is the solution.
I had two version of VS 2017 installed on my system.
I did upgrade the version of my VS , but instead of replacing existing one , it installed a parallel new version. After uninstalling and intalling only latest version , problem was fixed.

Related

VS 2019 Project Target Framework Not Installed - .Net Framework 4.0

Just installed VS 2019 Pro on a new system. When I open a solution with .net 4.0 project, I get this error: Project Target Framework Not Installed.
When I choose download it, it goes here but does not have option for .net framework 4.0.
In project settings there is no option for .Net Framework 4.0 in targeting framework:
https://dotnet.microsoft.com/en-us/download/visual-studio-sdks?cid=getdotnetsdk
I have tried installing 4.6.2, 4.5.2, etc.
How can I get this project to open? It opens on my other machine. It has these options for Target framework in project settings:
Please don't say change the framework version, we need this older version for very old computers running XP and Win 7 that cannot be upgraded.
thank you
You have to go directly to their download site. As shown in another correct answer that was downvoted, it's still available even though it's past end-of-life.
https://stackoverflow.com/a/72870727/9008140
You can package the install files with your app just in case, although most likely your installer will see that it's missing and download it anyway.
You can try downloading .Net 4.0 here: https://dotnet.microsoft.com/en-us/download/dotnet-framework/net40
Mandatory warning: Installing an old, unmaintained .Net framework comes with security risks. It's up to you to determine how much those Windows XP PCs are vulnerable and manage said risks.

How to Update Blazor Server App from .net core 6.03, to 6.04

I have a .net core Blazor Server App which is currently using version 6.03 of .net core.
Version 6.04 came out a few days ago, and I need to upgrade the project and then publish it so it is using the new bits.
I have:
Install the latest SDK from here which includes 6.04.
I also used Nuget to ensure all libs are on 6.04.
However, when I open the project, and check the file versions, it is still using 6.03.
I have looked for any setting in the project file that would indicate which version of .net 6, it is using, but I don't see any such setting. I only see this setting:
<TargetFramework>net6.0</TargetFramework>
Is there some way to get VS to use 6.04 instead of 6.03?
After quite a bit of working with this, I found that the minor version is tied to the Version of Visual Studio that you are using.
So, I was using VS 2022 Version 17.2.0 Preview 4, and the .net 6.0.4 bits had not been released yet for this version. So those bits are not accessible from this version.
However, the 6.0.4 bits have been released for VS 2022 Version 17.1.5. So by downloading and installing 17.1.5, the project then opened up using 6.0.4 without any other changes.
I am sure that soon the bits will be released for the 17.2 version soon.

.Net 6 Not show in Visual studio TFM,

It's weird.
If I create a new project and choose DotNet 6 framework by Visual Studio 2022. I will get the NETSDK1045 error code.
But create a new project from the console, everything is Ok.
Run dotnet --list-sdks and see if the expected .NET6 version is installed.
My guess is that you might have x86 issue. If you have installed x64 version, install x86 version and vice versa and test if the issue is gone.
You can also try to repair your VS 2022 instance and/or upgrade to latest official version.
There is also a small probability that you select a project type that does not supports .NET 6 (for example .NET Framework Web App project type).
Also you may check your path contains the dotnet folders in the correct order for your architecture.
References:
https://learn.microsoft.com/en-us/dotnet/core/tools/sdk-errors/netsdk1045
VS2017 : Target framework drop down does not show .NET Core 2.1 option

Visual Studio 2019 where to find WebAssembly template for .net core 3.1

I'm using very latest (16.4.2, dated 8th Jan 2020) Visual Studio 2019.
When I tried to create a Blazor WebAssembly solution, although the description for 'blazor app' included the words 'server or webassembly', when I got to the create page, only Server option was available and it successfully creates Core 3.1 application.
I assumed latest version would be there, so I went to the Visual Studio marketplace website and there were no Blazor extensions to be found, so looking on the internet I found running this command:
dotnet new -i
Microsoft.AspNetCore.Blazor.Templates::3.1.0-preview2.19528.8
(found via Missing visual studio 2019 blazor webassembly app template)
And it worked, I got web assembly option. However, when I look at my project created using WebAssembly it is using .net Core 2.0 and the options only go as far as 2.1. I presumed by the '3.1.0' section in the name it would be the latest.
Any idea how I get the latest template rather than random searching and use .net core 3.1?
If there is a better way, can anyone let me know how to uninstall templates as I failed to find out how.
Run the following in a CLI or in Tools -> Nuget package Manager -> Package Manager Console:
dotnet new --install Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview3.20168.3
The NuGet package for above is here.
Get started with ASP.NET Core Blazor here.
Update
The latest release is now an RC and can be installed with the following:
dotnet new -i Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-rc1.20223.4
The latest preview release as of April 30th can now be installed with the following:
dotnet new -i Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview5.20216.8
This requires the latest dotnet core SDK 3.1.201.
To check for the latest preview you can check the ASP.NET blog.

NuGet Can't Install Packages

I created a new .NET core Web App and I am trying to add packages Microsoft.EntityframeworkCore and Microsoft.AspNetCore and I am getting the error:
package restore failed rolling back packages
I have tried clearing the NuGet Caches reinstalling VS 2017 and the problem persists, note the project is brand new.
Please make sure your VS 2017 already upgraded to 15.3.5, you can re-run the VS 2017 installer as administrator and if there has the ‘Update’ button, click it to update. Then check you also installed the latest .NET Core 2.0 SDK and then create a new ASP.NET core web application, choose ‘ASP.NET Core 2.0’ as below to create:
Then you can successfully install those 2 packages through Manage Nuget Packages like the following:

Resources