Switching from Visual Studio 2022 for Mac to VSCode and Upgrading dotnet SDKs

Tony Pitman 80 Reputation points
2024-09-17T14:14:05.85+00:00

I am trying really hard to switch from Visual Studio 2022 for Mac to VSCode because VS2022 is out of support now. It is a really struggle.

One of the issues I am dealing with is upgrading the dotnet sdk. VS2022 always did that for me.

When I went to this page:

https://learn.microsoft.com/en-us/dotnet/core/install/upgrade

It has a link on there for MacOS. When I click on that link it takes me here:

https://formulae.brew.sh/cask/dotnet-sdk

That page shows using brew to upgrade dotnet sdks.

I use this command to see what sdks are available:

brew search --cask dotnet-sdk

That responds showing dotnet, dotnet-sdk and dotnet-sdk@preview

I use this command

brew list --cask dotnet-sdk (also tried without --cask)

This responds with a message the dotnet-sdk is not installed.

This worries me because I had a situation in the past where I had 2 different versions of the dotnet sdk on my mac and it caused all kinds of problems.

So if I have been using VS2022 for Mac to keep my dotnet sdk updated, how do I do that now using VSCode?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,471 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Shivakumar K S 0 Reputation points
    2024-09-17T15:40:06.6566667+00:00
    1. Install C# Extension: Open VSCode and go to the Extensions view (Cmd+Shift+X or Ctrl+Shift+X). Search for "C#" and install the C# extension by Microsoft. This will add support for .NET development.
    2. Install .NET Core CLI Tools: Ensure that the .NET Core CLI tools are installed and accessible from your terminal. You can verify this by running dotnet --version in your terminal.
    3. Configure Debugging: Create a .vscode folder in your project root if it doesn’t already exist. Then, add a launch.json file for debugging configurations. You can use the VSCode command palette (Cmd+Shift+P or Ctrl+Shift+P) and search for "Add Configuration" to help set this up
    0 comments No comments

  2. Bruce (SqlWork.com) 64,826 Reputation points
    2024-09-17T16:01:30.25+00:00

    brew is a popular package manager for MacOs. but it is opinionated. it will install all dev tools under its own folder structure. so, if you use brew you should delete your current .net installs and reinstall with brew. I tried brew, but went back to manual install. while brew does not notify of updates, brew update, updates all the tools in one command.

    I just use the .net download site. monthly just check if you are current sdk. as all updates are an side by side install anyway, this is simple:

    https://dotnet.microsoft.com/en-us/download

    and the cli tools for workloads:

    https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-workload-install

    after every new major release, I do a cleanup (vs did not do this anyway).

    https://learn.microsoft.com/en-us/dotnet/core/additional-tools/uninstall-tool-overview?pivots=os-windows

    https://msicc.net/how-to-use-the-net-cli-clean-up-tools-on-macos/

    note: vscode is no replacement for an ide (it is not meant to be). I find it fine for command line and asp.net projects. Dropping VS for Mac, was enough for me to abandon Maui. I just switched to swift/swiftui as I only do iOS and not android. I have not tried, but jet brains rider ide is popular for Maui development.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.