I have installed both .NET Core and .NET Framework on my machine. Currently if I type dotnet --version it shows that I'm using .NET Core. How can I swap from .NET Core to .NET Framework in my powershell?
2 Answers
dotnet is part of .NET Core. It's the command line interface to .NET Core (only). There's no dotnet command for .NET Framework.
You can use the dotnet command to build applications for .NET Framework. Edit your csproj and change it to target .NET Framework (TargetFramework of net472, for example) and then use dotnet build. That is still using the dotnet from .NET Core but targetting and using assets from .NET Framework.
Another way to use .NET Framework is to use msbuild.exe directly. That always ends up using .NET Framework. But there's no dotnet equivalents (dotnet run).
3 Comments
msbuild.exe. If your build produces executibles, you can run them directly.