Cannot load project using .NET Core after installing Visual Studio 2019 version 16.4 - asp.net-core

I have installed the community Visual Studio 2019 version 16.4.
and clone the solution of .NET Core 3.0 but no project loaded something wrong in the SDK.
I have installed the SDK and runtime for 3.0 and 3.1, but still can not load any project.

You could fix the VS 2019 issue with the below steps
Run dotnet --list-sdks to know the exact version of the SDK installed
Modify the global.json file in the root folder of the project (For example,the project was showing 3.0.100 but you had 3.0.101 installed, you need to edit the same to point to that version and you could be able to reload the projects.
References:
https://learn.microsoft.com/en-us/dotnet/core/versions/selection#the-sdk-uses-the-latest-installed-version
https://learn.microsoft.com/en-us/dotnet/core/tools/global-json#globaljson-and-the-net-core-cli

I had the same problem after I uninstalled Visual Studio 2022 Preview. Removing the C:\Program Files (x86)\dotnet\ directory from my PATH variable solved it.

Related

Building a net40 project in VisualStudio 2022

A Windows update trashed my computer so I've had to reinstall from scratch.
We have some projects that multi-target net40
<TargetFrameworks>net40;net6.0</TargetFrameworks>
which were building just fine (and they build in the Azure pipeline) but now I can't get them to build locally.
My old machine was originally win10 with VisualStudio 2017, 2019, and 2022, but so far on the rebuilt machine I only have 2022.
The projects won't build, saying
error MSB3644: The reference assemblies for .NETFramework,Version=v4.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
I guess this means I have to install an SDK pack?
I've tried 4.6.2 and 4.6.1 which are available through the VisualStudio installer, and 4.5 (NDP452-KB2901951-x86-x64-DevPack.exe from https://dotnet.microsoft.com/en-us/download/dotnet-framework/thank-you/net452-developer-pack-offline-installer) which is not, and Windows SDK for Windows 7 and .NET Framework 4 from https://developer.microsoft.com/en-gb/windows/downloads/sdk-archive/
but still no joy.
Any idea what I need to do to get it to build again?
The solution seems to be to install VisualStudio2017 with net40.

.Net5 sdk is installed but why can't choose to create project

I recently installed versions of .net core sdk 3.1 and 5. When using the .net5 version today, I found that I couldn't select the version when I created the project, only version 3.1. So I opened the terminal and entered the command: dotnet --list-sdks to query all my installed versions and found that only 3.1.405[C:\Program Files\dotnet\sdks] is displayed. What is the reason for this? I'm sure I have the sdk for .net5 installed. I got it from this site.
https://dotnet.microsoft.com/en-us/download/visual-studio-sdks
I recently installed versions of .net core sdk 3.1 and 5. When using
the .net5 version today, I found that I couldn't select the version
when I created the project, only version 3.1
The issue might relates the Visual Studio version. From the Asp.net core document and the SDK download page, we can see that to use Asp.net 5, it required Visual Studio 2019 16.8 or later version:
So, you can upgrade the VS 2019 version to Visual Studio 2019 16.11.9 version or Visual Studio 2022, and then in the Visual Studio Installer click the "Modify" button on the installed Visual Studio, in the popup window, go to the Individual components panel, checked the .NET 5.0 runtime option:
Then when create new applications using Visual Studio, you can choose the .Net 5.0 version.

Visual Studio 2022 does not find reference assemblies for >NETframework Version 4.0

Trying to compile Python Django project but receiving build error:
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(1217,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
Done building project "myFinancialTracker.pyproj" -- FAILED.
How can I resolve?
I also got the same error as you, this is because VS 2022 doesn't come with
.net framework 4.0 option during installation, to overcome this problem I install VS 2019 and enable the usage of .net-framework 4.0 during installation. After the installation, I tried to run my project again using VS2022 and the error goes away.
I tried to download and install .net-framework 4.0 separately but Microsoft doesn't allow me to do so, to overcome this, I install VS2019 instead.

How to open dotnet-core CLI project in Visual Studio 2017

I have been developing a simple application using dotnet Core (for an API) and Angular2 for the purpose of learning both.
I created the project using Yeoman on the command line and have been happily coding away in Visual Studio Code (on Windows). All seems to hang together well and it's been an enjoyable experience.
I thought I might try out Visual Studio 2017 and see what the experience of developing a dotnet Core project in VS is like for a while.
However, having installed VS2017 and cloned the project from github I am unsure how to proceed. I can't see any way to restore/build/run the project.
After cloning the repo, I see my project displayed in the Solution Explorer with the project.json file visible. However, Debug | Start is greyed out. I read somewhere about VS2017 needing to convert project.json to the new (old?) XML format and also I have a feeling I am missing a .sln file.
I would appreciate it if someone could point me in the right direction.
If your project has an .xproj file
Open Visual Studio.
File > Open > Project/Solution.
Open the xxx.xproj for your solution.
If your project lacks an .xproj file
Install .NET Core SDK Preview 3 or higher.
Open a command prompt at your project's directory.
Run dotnet migrate.
Open the resulting .csproj in Visual Studio 2017.
Troubleshooting
View migration help with dotnet migrate -h.
If you have a global.json file, update its SDK version before running migrate. E.g.
{
"sdk": {
"version": "1.0.0-preview4-004233"
}
}
View installed SDK versions with dir 'C:\Program Files\dotnet\sdk\'.
Update Visual Studio 2017 and its installer. On my machine, the above works with Microsoft Visual Studio Community 2017 RC Version 15.0.26014.0 D15REL.
Update .NET Core SDK. On my machine, the above works with SDK 1.0.0-preview4-004233.

VS2012 RTM missing .net 4.5 and mvc project templates

On Windows 8 RTM and just installed Vs2012 Ultimate RTM, I'm unable to create a .net 4.5 project nor a .net 4 or 4.5 ASP.NET MVC project. I've done a repair of VS2012, which did not fix it. Is there something obvious I'm doing wrong?
I also had the same problem..
Doing the following procedure solved it.
Copy the folder \packages\WPT from the visual studio 2012 installer CD to your desktop.
Uninstall the following in this order..
aspnetmvc4vs11tools.msi
aspnetmvc4.msi
aspnetmvc3vs11tools.msi
aspnetmvc3.msi
Then install these in this order.
aspnetmvc3.msi
aspnetmvc3vs11tools.msi
aspnetmvc4.msi
aspnetmvc4vs11tools.msi
Trying to repair didn't fix the problem. You have to remove and install these..
Hope this will help...
Your install is probably corrupted. VS 2012 needs .net 4.5 to run, so something has gone wrong if it's not available.
I would try uninstalling and reinstalling. It's brute force but it generally works.
You probably do not have the Windows 8.1 SDK installed. Visual Studio 2012, nor its updates, link the .NET Framwork 4.5 libraries for development.
Windows 8.1 SDK
You don't have to install the full SDK if you are just looking for the option to build web apps, just the .NET Framework 4.5.1 option in the installer. The full install is about 1.1GB, but just the .NET installer is only 72MB.
For those reading this that have not updated their copy of Visual Studio 2012, make sure you also have these installed:
Visual Studio 2012 Update 4
ASP.NET and Web Tools 2013.1 for Visual Studio 2012
Hope this helps!
Change .net framework version to 4.5