The majority of .NET core tutorials online seem to use Visual Studio code, rather than Visual Studio (Full fat? Is there a proper term for the full version? I use Professional but there is also Community, Enterprise etc).
These tutorials make the most of the integrated terminal within VS code for running dotnet command line commands (dotnet new, dotnet build etc).
I am struggling to find where to execute these commands in Visual Studio. Where is the right place to do this? I have .NET core SDK installed.
I have seen some suggestions for the package manager console - although this seems odd, why should I be running dotnet commands via a "package manager console"?
You can run the generated C# code projects with Visual Studio by pressing the F5 key or with dotnet run (. NET CLI).
In . NET Core, it runs from the dll, so you have to just run the application by running the command prompt and using the command - dotnet run. Open your command prompt and go to that folder where your application persists.
The full version of Visual Studio is "Visual Studio", "Code" is what differentiates "Visual Studio Code".
As far as an integrated command line inside Visual Studio goes, the Package Manager Console is it. It's basically just powershell, with some addins from Visual Studio and any extensions or NuGet packages you have installed. It gets its name from the fact that it was introduced specifically for the management of NuGet packages, but was quickly co-opted by things like Entity Framework, and just continued to grow from there. Admittedly, Microsoft should probably consider rebranding it, but there's so much documentation, articles and tutorials out there that reference the "Package Manager Console", that it would probably actually create more confusion if they renamed it.
While you can run dotnet
commands through it, I'd imagine the results would be a bit unpredictable. Perhaps I'm wrong here, as I've never even tried to do things like dotnet new
from the PMC, but the PMC is not really directory-based like a traditional console window. It's more contextual in nature, applying commands to target projects. I do know that things like dotnet restore
and such work fine, and dotnet new
may as well. You'll just have to try it.
That said, I tend to take an all or nothing approach with Visual Studio. It's a beast, and if you're going to install it and use it, you might as well use it. You can do everything you can do with dotnet
through the GUI. And, for those few times where you might need something special, you can pop a console window. If you want to do everything with dotnet
, Visual Studio quickly becomes overkill, and Visual Studio Code would probably be much more efficient for your workflow.
Update: Visual Studio 2019 16.6 now has it's own Terminal (Hoorray!). Check View -> Terminal or try to press Ctrl + `.
Old answer:
There are extensions for that. I tried BuiltinCmd and Whack Whack Terminal, the latter worked better for me. You can choose between CMD and PowerShell, all dotnet CLI commands works just fine.
While following a tutorial to update database, I had to run these commands
dotnet ef migrations add MaxLengthOnNames dotnet ef database update
in the command window of Visual studio, as per tutorial. When I opened this window in visual studio (View > Other Windows > Command Window) and attempted to run these commands, I received this error:
>dotnet ef migrations add MaxLengthOnNames
Command "dotnet" is not valid.
>dotnet ef database update
Command "dotnet" is not valid.
>
When I attempted to run them in Package Manager Console, this is the result I got:
No project was found. Change the current working directory or use the --project option.
Now, I googled it a bit and got the hint that I must run these commands in windows command prompt (opened by typing "cmd" in Windows start search). Steps are:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With