Cheshie
Cheshie

Reputation: 2837

How to run Dart code from Visual Studio?

I'm building an asp.net website using Visual Studio 2012. I'm considering adding some dart code into it.

I'm trying to check how this thing works: I downloaded the DartVS visual studio extension, and I took a ready dart code from the web. The dart code runs fine on dartium when I run it from the dart IDE.

I copied and pasted the code to Visual Studio (that now recognizes dart thanks to the extension). When I run it from there - I could see that the GUI appears, but the buttons don't seem to work. I put a breakpoint in the dart code's main function but it doesn't seem to get there.

What am I doing wrong?

Thanks!

Upvotes: 5

Views: 3772

Answers (3)

Danny Tuppeny
Danny Tuppeny

Reputation: 42383

Edit: Although not full Visual Studio, I have created a VS Code extension that does support debugging here.

I'm the author of the extension you linked. Currently, there is no debug support. If you're going to launch from VS in the browser, you'll need to add Dartium to the list of browsers in Visual Studio.

The current version of the extension is very limited and just uses regular expressions to syntax highlight and runs the command-line Analyzer for error info. Both of these kinda work; but have some flaws.

I'm working on a new version; which is backed by a service written by Google, which has very reliable syntax highlighting, tooltips, GotoDefinition, code-completion and more. It's not ready for testing quite yet; but it'll be pushed as an update to the extension you already have once it's done.

The plan is to ultimately include Visual-Studio debugging; but for now, I'd recommend using Dartium and debugging in the developer tools.

Upvotes: 5

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657781

You can start pub serve and Dartium manually and point Dartium to the URL pub serve listens to.
DartEditor also launches pub serve for this.

I don't know if your extension has any debugging support but in Dartium you can debug Dart and JavaScript code like JavaScript code in the normal Chrome browser dev-tools.

Upvotes: 1

Robert
Robert

Reputation: 5662

When you run the code from VS - where does it get executed? Dart is only supported in Dartium so far - so if you want it to work in any browser, you have to use dart2js for now.

I don't know what that Extension does but this might be the problem.

Regards, Robert

Upvotes: 1

Related Questions