I have same problem like someone have here:
Visual Studio get stuck on "Restoring packages for solution"
I try the following:
Clear nuget cache from Tools menu. and temp, %temp% folders from RUN command.
Clear visual studio cache from here. C:\Users\Dell\AppData\Roaming\Microsoft\VisualStudio\17.0_27e1b93f
Clear .vs hidden folder of solution.
Clean and Rebuild Solution. But stuck into Restoring Nuget packages...)
I wait 15 minutes. But nothing happened.... (There's bug here?)
I only use less than 7 nuget packages from nuget.org
Here's Visual Studio Log:
Microsoft Visual Studio Community 2022
Version 17.2.6
VisualStudio.17.Release/17.2.6+32630.192
Microsoft .NET Framework
Version 4.8.03761
Installed Version: Community
.NET Core Debugging with WSL 1.0
.NET Core Debugging with WSL
ASP.NET and Web Tools 2019 17.2.393.26812
ASP.NET and Web Tools 2019
Azure App Service Tools v3.0.0 17.2.393.26812
Azure App Service Tools v3.0.0
Azure Functions and Web Jobs Tools 17.2.393.26812
Azure Functions and Web Jobs Tools
BusinessObjectEditor 1.0
Information about my package
C# Tools 4.2.0-4.22281.5+8d3180e5f00d42f0f0295165f756f368f0cbfa44
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
CreateLayoutWizard 1.0
Create layout wizard.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
NuGet Package Manager 6.2.1
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Razor (ASP.NET Core) 17.0.0.2218101+885a343b00bcab620a90c1550c37dafd730ce984
Provides languages services for ASP.NET Core Razor.
SQL Server Data Tools 17.0.62204.01010
Microsoft SQL Server Data Tools
TypeScript Tools 17.0.10418.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.2.0-4.22281.5+8d3180e5f00d42f0f0295165f756f368f0cbfa44
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 17.1.0-beta.22329.1+702b8e77f5fbfe21e6743324c1750503e02f182d
Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.
More Information:
I use old *.csproj project template (non-sdk)
I use PackageReference not packages.config
.NET 4.8
Windows 7
No proxy used. and official nuget.org/api/.... works in browser.
NOTE: this happened when I re-installed operating system.... Sometimes it took time. Sometimes it freeze and hangs on Restoring Nuget packages... message
Please how to solve that?
According to your description I think the problem is that you used PackageReference and use nuget.exe to restore the packages.
We can see from this link that For projects migrated to PackageReference, use msbuild -t:restore to restore packages instead.
You can try msbuild -t:restore instead of nuget restore ***.csproj to restore packages if you are using PackageReference. For more details, please refer to the above link
While it is correct to consider the msbuild alternative when using command line, it is still very annoying for anything inside Visual Studio 2022. I am hitting it on many scenarios, like trying to run tests after build was successful.
Fortunately, it is now fixed in the latest Visual Studio 17.5.0 Preview 6.0
https://visualstudio.microsoft.com/vs/preview/
Related
I downloaded the repository https://github.com/dotnet/runtime and followed this workflow guide https://github.com/dotnet/runtime/blob/master/docs/workflow/README.md
After that, I ran the build.cmd from root directory of the repository. Took me a while to build the project but when I opened any of the Visual Studio solution from one of its libraries (i.e System.Text.Json.sln) I had this error: The project file cannot be opened. Version 5.0.100-rc.2.20479.15 of the .NET Core SDK requires at least version 16.8.0 of MSBuild.
I also downloaded the SDK for .NET 5.0.100-rc.2.20479.15.
Question: How can I have the MSBuild version 16.8.0 on Visual Studio 2019 v16.7.6? Or what am I missing?
Projects built against .NET Core 5.0, preview2 (as the one you have there) require Visual Studio 2019 preview. You can download it from Microsoft, it works with the same license as the official releases.
Is Roslyn the default compiler in Visual Studio 2017?
I found this article
which tells that Roslyn is not the default compiler and you should install Nuget packages to enable Roslyn.
Nuget packages:
Microsoft.CodeDom.Providers.DotNetCompilerPlatform
Microsoft.Net.Compilers
But I also saw an answer on stackoverflow that says, Roslyn is the default compiler starting from VS 2015.
And when i am install that nuget packages, it's creating a new folder in /bin
with name 'roslyn'
Yes, Roslyn is the default compiler in Visual Studio.
In the article you link, it only says you need to install it separately if you are trying to use it without Visual Studio:
To date, Roslyn has remained a part of Visual Studio 2015 and is installed together with it. Roslyn is a part of Visual Studio 2017 as well. It has been released in March 2017.
However, Roslyn is not included in the .NET Framework. Even in the .NET Framework 4.6 version, the traditional csc.exe and vbc.exe compilers are included. This is done for it to be compatible with previous .NET Framework versions.
To install Roslyn compilers without installing Visual Studio, you need to download and install Microsoft Build Tools. Roslyn can also be downloaded from Github, then you can compile and get binary files csc.exe and vbc.exe, which can be accessed from the command line.
You would typically only need those NuGet packages if you were building an application or service for compiling code (or similar), which is what that article is about. That is, when your application is actually using Roslyn at runtime to process code, rather than itself being built with Roslyn.
After downloading and installing Visual Studio 2019 RC, I cannot run msbuild, and get the following error:
"Version 2.2.202 of the .NET Core SDK requires at least version 16.0.0 of MSBuild.
The current available version of MSBuild is 15.6.82.30579.
Change the .NET Core SDK specified in global.json to an older version that requires the MSBuild version currently available."
I cannot find MSBuild version 16. The only version I find is this one here:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0"
.NET Core SDK versions 2.2.2XX and 2.1.6XX are intended to be used with Visual Studio 2019 and MSBuild 16.x.
.NET Core SDK versions for Visual Studio 2017 are 2.2.1XX and 2.1.5XX.
See this GitHub issue for more details.
Updating Visual Studio to the minimum supported version or above should fix this problem.
Some .NET Core versions also include fixes in MSBuild. They are distributed together with Visual Studio.
They put the minimum supported versions in the release notes of .NET Core.
For example: Announcing .NET Core 2.2 | .NET Blog
For people coming here because they have the in Azure DevOps Pipelines - here some pointers for that.
If you have a private agent pool configured (e.g. private build machine), you might want to update your machine to support a more recent MSBuild version. See other answers.
If you don't have configured a build agent and use a default agent pool provided by Azure DevOps itself (e.g. "Hosted" or VS2019), see if there is a newer Hosted one that supports your configuration. See screenshot below where to look.
I ran into this with our on-prem build server we use with GitHub Actions.
The solution was to run Visual Studio Installer and update Visual Studio Build Tools 2017 and 2019.
I realize this solution is very similiar to those above, but I wanted to speak to the situations where Visual Studio is not installed, but Build Tools are.
For anyone that is still coming across this issue. I found another way, to get around this without upgrading to VS 2019 or rolling back SDK 3.1. My experience is in TFS 2017 (on-prem). I'm the build engineer, not a developer.
I had an SDK 2.2 app that was failing after the install of 3.1.
Initially, it was causing the NuGet steps to fail. Research led to me asking the developers to add a global.json file having it point to 2.2. This fixed the NuGet errors.
Then MSBuild step was failing with similar to OPs message. Couldn't figure out why 3.1 was taking presedence over 2.2 when it was listed in global.json. So I started digging around in the SDK in stall folders (typically located in C:\Program Files\dotnet\sdk). I came across a file named minimumMSBuildVersion In the SDK\3.1.101 folder that file has version 16.3.0 of MSBuild listed. I then went to the SDK 2.2 folder and checked it there. It has version 15.3.0 which my build server has. I simply changed the version to this in the 3.1 folder and my build succeeded. I hope this helps anyone that may still be experiencing build issues when .Net Core SDK versions are updated on their TFS Build Servers.
I am learning how to build a Blazor app from this tutorial.
The required tools are given as follows.
Install the .NET Core 2.1 SDK (2.1.300-preview2-008533 or later).
Install Visual Studio 2017 (15.7 Preview 5 or later) with the ASP.NET and web development workload selected.
Install the latest Blazor Language Services extension from the Visual Studio Marketplace.
Because downloading and installing VS 2017 take much time, I just installed the SDK. I also downloaded the language service (.vsix file) but don't know how to install it.
The following steps succeeded.
md test
cd test
dotnet new -i Microsoft.AspNetCore.Blazor.Templates
dotnet new blazor -o ba1
cd ba1
But the following
dotnet run
produces an error as follows:
CSC : error CS1617: Invalid option '7.3' for /langversion. Use '/langversion:?' to list supported values. [C:\Users\amd\test\ba1\ba1.csproj]
Question
It seems I need to install the language service, but how can it be done without VS 2017?
Edit
For answering the comment why I did not install VS 2017 and assume (I did not assume actually) it optional, see the excerpt taken from the tutorial.
The language service is for intellisense in Visual Studio. So if you are not using Visual Studio there is no need to install it. There is no blazor intellisense support for VSCode right now or something.
See here for the 7.3 error.
I've created a .NET core console application on Visual Studio(VS) 2015 Community edition Update 3. I've installed .NET core 1.0.1 Preview 2 Visual Studio 2015 tools.
I know for one thing that while running the .NET Core application for the first time, Visual Studio restores all the .NET Core nuget packages and dependencies in some location on local computer. It is certainly not the root directory of my project as I can observe it myself.
Can anyone help me with the exact path where I can see all the .NET core nuget packages getting downloaded?
You will find all of the common .NET Core packages in C:\Program Files\dotnet\shared.
Use this cmd to find the path: dotnet nuget locals global-packages -l