How to run application from Visual Studio in Mac terminal - visual-studio-mac

I'm working on a netcore 3.1 console application in Visual Studio 8.9.10 on mac.
When running it the application executes in terminal window inside Visual Studio itself.
When i click Run button I would like it to run in mac terminal instead.
I cannot find the proper setting in projects options - there's no checkbox like "Run on external console" or anything.
Thank you in advance.

I'm not positive this is the only way, but my guess is that attaching a debugger to a program started from Terminal is the only way for now.
Something like this: https://stackoverflow.com/a/552788
Replicated here for ease and posterity:
using System;
using System.Diagnostics;
using System.Threading;
namespace DebugApp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Waiting for debugger to attach");
while (!Debugger.IsAttached)
{
Thread.Sleep(100);
}
Console.WriteLine("Debugger attached");
}
}
}

Visual Studio for Mac can be configured to use the macOS Terminal app in Preferences - Other - Terminal. Uncheck 'Enable integrated terminal' to use the external macOS Terminal app.

Related

Error while trying to add docker support : Value cannot be null ... netCoreVersion

I had a very simple .Net Core console app that I was using to try experiment with docker/containers. I had heard that Visual Studio had great docker support and wanted to see if I could leverage it. After creating the .Net Core from the Visual Studio Templates, I right-clicked the Project to add "Docker Support...", then when prompted for Linux vs Windows, I selected Windows and then got the following error:
An error occurred while adding Docker file support to this project.
Value cannot be null.
Parameter name: netCoreVersion
I've tried various things and nothing seems to be working.
After much troubleshooting, this is what solved my problem. The TargetFramework I was using was not being recognized by Visual Studio. I wanted to test using a Windows only build because that is my primary use case.
Right-clicking the Project Properties, the TargetFramework was .NET 6.0 but the Target OS was Windows and NOT (None).
Those 2 settings combine the csproj file to have a setting of
<TargetFramework>net6.0-windows</TargetFramework>
instead of
<TargetFramework>net6.0</TargetFramework>
The Fix
Essentially get your TargetFramework to be net6.0. You can edit raw, or just select (None) as your Target OS. You can then add the Docker File, and then reset your project back to your Target OS.

How can I run a visual studio project from the mac command line?

I have a visual studio project that generates an exe file. I can run this project from within Visual Studio Community for Mac simply by clicking Run for the Release or Debug configurations.
I need to be able to do this from the command line. I've tried using wine but it throws exceptions that I never see in VSC.
Thanks #Lex Li!
The solution is to open a terminal and run
mono <path to your app> <your app's arguments>

Visual Studio for mac: how to run a terminal

I'm new to Visual Studio on mac, can someone show where we can run a terminal window to execute some git commands?
Terminal window is not a part of the built-in tools within Visual Studio for Mac. There might be some add-ins or extension for this, but I am not aware.
However, there is a GUI Git tool called 'Version Control' which is integrated to VS, you can use it.
If you still want to use a terminal window, you can open a separate terminal window, outside of the VS. Alternatively there is an VS fro Mac add-in that allows you to open a terminal window (again outside of the VS) on any solution's dir.
UPDATE:
You can open any directory from Visual Studio for Mac in a terminal by right-clicking any project directory > Tools > Open in Terminal
In Mac VS2019, I found access to Terminal
under Solution navigation
Select your Project
Crl-Click (hold)
Navigate to Tool
Open in Terminal
It seems to work for me!
Visual Studion for Mac Previews now include a terminal as of April 2020
Tools->Show Terminal Window or crtl+`
https://devblogs.microsoft.com/visualstudio/meet-visual-studio-for-macs-new-integrated-terminal/#:~:text=%20Meet%20Visual%20Studio%20for%20Mac%E2%80%99s%20New%20Integrated,at%20any%20time.%20%20...%20%20More%20

ASP.NET OmniSharp server is not running on Ubuntu Mono

After setting up VS Code, I'm trying to run an ASP.NET 5 project using Visual studio code's command palette on Ubuntu Linux 14.4.
The DNVM installed is for Mono. Following the steps given on VS code's official docs, the project is created with Yeoman scaffolder.
Whenever trying to start the project, I get the following error:
OmniSharp server is not running.
I found some posts when trying to solve this but most seems to be addressing either Console project or are given for OS x:
For a Console App
This is for debugging not running
The output of mono --version shows that it is >3.12:
My dnvm is already the latest
I can run the project by using dnx web command from Terminal.
However, my simple question:
How do I run ASP.NET 5 on Ubuntu using VS Code?
Side question : Not sure by when the debugging will be supported. Any rumours about the extension will be appreciated.
This seems to be a bug with OmniSharp and not specifically with VSCode

Dart editor run error "could not start pub serve or connect to pub" on it's sample web application project

I just installed Dart Editor and created a simple web application and when I click on run it shows this error and nothing happens.
"could not start pub serve or connect to pub"
How is the configuration of dart editor for Windows7 sp1 64bit?
What am I supposed to do to run the sample project?
It is a common problem
http://dartbug.com/20771 (mentions that an internet connection is necessary)
http://dartbug.com/19659
http://dartbug.com/19847
http://dartbug.com/19656 (it was mentioned that reinstall Dart helped)
Nothing contains a good solution.
For weird problems it's always worth to try pub cache repair on the command line.

Resources