Create new Core 2.0 web project, core libraries can't be loaded - asp.net

Visual Studio 2017, when creating a new ASP.NET Core Web project with ASP.NET Core 2.0, e.g. React w/ Flux preset, the core dlls fail to load. Nuget package restore does nothing, but I can uninstall and reinstall the AspNetCore.All package. If I do this, I get the following error:
Error MSB3073 The command "node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js" exited with code 8. ReactTest [PATH]\source\repos\ReactTest\ReactTest\ReactTest.csproj 33
I don't suspect this is a real error, I suspect it's because of the initial package install failure. I have been able to perform this operation on other devices, so I know that I am following the correct processes and have the correct SDKs and toolsets installed. I have repaired, and uninstalled / reinstalled Visual Studio 2017 with reboot and nothing has fixed this.

I had the same problem. My version of node.js was ancient (in web terms...). I installed the latest version (8.8.1) and everything was fine.

Related

VSCode Omnisharp server A .NET 6 SDK for x86_64 was not found

Omnisharp does not seem to recognize my installed .NET sdk (version 6.0.408).
I have tried manually adding this path via settings to Omnisharp: SDK path i.e.:
C:\Program Files\dotnet\sdk\6.0.403
I have also tried reinstalling the SDK and even VSCode.
This does not seem to solve the issue however, and I am unable to run my asp.net application on VSCode. Running dotnet run from the terminal is fine.
TLDR: Both .NET SDK versions and Visual Studion versions needed to be x64.
Here was the exact error I was seeing in the Output Window:
[ERROR] A .NET 6 SDK for x86_64 was not found. Please install the
latest x86_64 SDK from
https://dotnet.microsoft.com/en-us/download/dotnet/6.0.
[ERROR] Error: OmniSharp server load timed out. Use the
'omnisharp.projectLoadTimeout' setting to override the default delay
(one minute).
When I realized there was a mismatch between my .NET SDKs and Visual Studio Code in terms of being x86 and x64, I did the following:
Deleted the bin/obj folders and .vscode folders in my VS Code project.
Uninstalled my .NET SDKs via Windows (Setings > Apps).
Uninstalled Visual Studio Code via Windows (Setings > Apps).
Installed .NET 7.0 x64 and .NET 6.0 x64.
Opened PowerShell and ran dotnet --info to make sure my .NET runtime and SDK were appearing correctly.
Installed Visual Studio Code x64.
Used PowerShell and cd'd to my project folder. Did a dotnet restore. Then launched Visual Studio Code using code . command.
I could then use the most current version of the VS Code extension (v1.25.2).
Uninstalling and then installing the VSCode extension C# for Visual Studio Code solved the issue for me.
I had the same problem and just solved it. Copy and pasting this from a Youtube comment I just finished writing, so it might sound funny out of context, but the good bits are in there. Hope it helps.
Installed dotnet 7.0, but then it said dotnet 6 was missing...
So I deleted the script asset, exited Unity, went back to their website and installed Net 6.0.403
Error still happened.
I'll note this seemed to push a script compiling error out to Unity in the inspector window, as well.
Deleted the script asset again, exited Unity again, then uninstalled both dotnet 7 and dotnet 6.
Then I reinstalled dotnet 6.
Into unity, made a new script, opened it, and this time no error message about missing net 6.
I just started yesterday. Literally. So if my solution is trash, I'll laugh with you lol. Best of luck.

Upgrading runtime and sdk and packages to .NET 6

I was following this tutorial on building an application with ASP.NET Core API and Angular where I used a laptop that had .NET 5 installed.
I got a new laptop and after I installed all the latest tools, I am now on .NET 6 and when I open my app to carry on where I left off, I get the following error when I run dotnet watch run in the VS Code terminal in the backend folder:
The framework 'Microsoft.AspNetCore.App', version '5.0.0' (x64) was not found.
- The following frameworks were found:
6.0.5 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=5.0.0&arch=x64&rid=win10-x64
Here are 2 screenshots showing what I have installed in this app from the time I was using it on my old laptop (now opening it and trying to run it on my new laptop)
Is there anyway I can cleanly update everything I need in one go, instead of installing .NET 5 or AspNetCore.App version 5.0.0 etc?
Just correct the TargetFramework element's text content to net6.0.
Also update the NuGet packages.
Don't mind what's inside the bin and obj folders, whereas exist. Even better, make sure to Clean or Rebuild your project.

dotnet build stopped working after VS 2022 upgrade

I upgraded Visual Studio Community to the final release, and it stopped working. Specifically, I could generate a new project, but when I try to load it, it gave me an error
Critical Project 'SdkTest' load failed| [MSB4236] The SDK 'Microsoft.NET.Sdk.Web' specified could not be found. ...\SdkTest.csproj
Even though build and run worked fine
I ran "repair" on VS2022, and it seems to be working now from Visual Studio. However, dotnet --info doesn't show any SDKs; only runtime; and dotnet build or dotnet new give an error:
C:\Code>dotnet new console -o myapp
Could not execute because the application was not found or a compatible .NET SDK is not installed.
Possible reasons for this include:
* You intended to execute a .NET program:
The application 'new' does not exist.
* You intended to execute a .NET SDK command:
It was not possible to find any installed .NET SDKs.
Install a .NET SDK from:
https://aka.ms/dotnet-download
I even reinstalled .NET 6 and I see it in the list of applications (along with older SDKs). I checked the path, and I see everything that I expect to see:
C:\Program Files (x86)\dotnet\
C:\Program Files\dotnet\
C:\Users\me\.dotnet\tools
I am running Windows 11.
It's known bug in VS2022 installation.
Problem is that dotnet you access is located inside Program Files(x86)/dotnet, but all sdk's are located in Program Files/dotnet. You simply need to edit PATH environment variable so Program Files/dotnet goes before Program Files(x86)/dotnet. If you don't see Program Files(x86)/dotnet in user environment variable (which is likely to happen) then edit system environment variable (located below)
Example with screenshots: https://stackoverflow.com/a/44272417/10339675

Issue to install core3.1 VSBuildTools offline installer 2017 using workload

When we trying to install the offline installer which is generated using below workload getting exited with errorlevel 1 . Any advise please?
.\vs_buildtools__140882496.1541481122.exe --layout .
--add Microsoft.VisualStudio.Workload.MSBuildTools
Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools
Microsoft.VisualStudio.Workload.WebBuildTools
Microsoft.VisualStudio.Workload.NetCoreBuildTools
Microsoft.Net.Component.4.5.2.TargetingPack
--lang en-US
Error
Something went wrong with the install.
If the issue has already been reported on the Developer Community, you can find solutions or workarounds there. If the issue has not been reported, we encourage you to create a new issue so that other developers will be able to find solutions or workarounds. You can create a new issue from within the Visual Studio Installer in the upper-right hand corner using the "Provide feedback" button.
================================================================================
Package 'Microsoft.Net.4.7.2.FullRedist,version=4.7.3062.3' failed to install.
Search URL
https://aka.ms/VSSetupErrorReports?q=PackageId=Microsoft.Net.4.7.2.FullRedist;PackageAction=Install;ReturnCode=16389
Details
Command executed: "C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.Net.4.7.2.FullRedist,version=4.7.3062.3\dotNetFxLatest-x86-x64-AllOS-ENU.exe" /q /norestart /KeepAUPaused /ChainingPackage Visual_Studio_15_Setup /CEIPconsent /log "C:\Users\Administrator\AppData\Local\Temp\dd_setup_20200103140616_004_Microsoft.Net.4.7.2.FullRedist.log"
Return code: 16389
Return code details: Unknown error (0x00004005)
Log
C:\Users\Administrator\AppData\Local\Temp\dd_setup_20200103140616_004_Microsoft.Net.4.7.2.FullRedist.log
Impacted workloads
.NET desktop build tools (Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools,version=16.4.29511.114)
MSBuild Tools (Microsoft.VisualStudio.Workload.MSBuildTools,version=16.0.28516.191)
Web development build tools (Microsoft.VisualStudio.Workload.WebBuildTools,version=16.4.29409.204)
Impacted components
.NET Framework 4.7.2 development tools (Microsoft.Net.ComponentGroup.DevelopmentPrerequisites,version=16.3.29207.166)
.NET Framework 4.7.2 targeting pack (Microsoft.Net.Component.4.7.2.TargetingPack,version=16.0.28517.75)
C# and Visual Basic Roslyn compilers (Microsoft.VisualStudio.Component.Roslyn.Compiler,version=16.0.28714.129)
MSBuild (Microsoft.Component.MSBuild,version=16.4.29429.68)

The project was restored using Microsoft.NETCore.App version 2.1.3, but with current settings, version 2.1.3-servicing-26724-03 would be used instead

Got this error today after upgrading VS2017 to v15.8.2 and trying to build my dotnet core project (target framework .NET Core 2.1):
Severity Code Description Project File Line Suppression State
Error NETSDK1061: The project was restored using
Microsoft.NETCore.App version 2.1.3, but with current settings,
version 2.1.3-servicing-26724-03 would be used instead. To resolve
this issue, make sure the same settings are used for restore and for
subsequent operations such as build or publish. Typically this issue
can occur if the RuntimeIdentifier property is set during build or
publish but not during restore. For more information, see
https://aka.ms/dotnet-runtime-patch-selection.
What to do?
Found out solution:
Uninstall .NET Core SDK 2.1.401, that came with vs2017 v15.8.2 and install it again using an installer from the .NET Downloads page.
Source: #joshuadavidson https://github.com/dotnet/cli/issues/9897
Also quote #peterhuene:
"It's come to my attention that VS 15.8.2 did not include the correct,
final build of the 2.1.401 SDK. We are working on resolving this
issue. In the meantime, uninstalling the 2.1.401 SDK installed by
Visual Studio and installing the SDK from the .NET Downloads site
should correct the issue."
Update, September 7th 2018:
or simply upgrade to VS2017 v15.8.3, where the problem is resolved:
"Visual Studio 2017 version 15.8.2 contained a pre-release build of
.NET Core SDK 2.1.401 that is incompatible with Visual Studio. We have
corrected this issue with Visual Studio 2017 version 15.8.3."

Resources