Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run code that uses (nuget) packages #228

Closed
dhowe opened this issue Dec 26, 2017 · 3 comments
Closed

Run code that uses (nuget) packages #228

dhowe opened this issue Dec 26, 2017 · 3 comments
Labels

Comments

@dhowe
Copy link

dhowe commented Dec 26, 2017

So I have a simple csharp program (see below) which works in vscode/code-runner until I add a package. As soon as I install one via nuget (e.g., Antlr4), I can no longer run via code-runner, though things still compile ok.

What am I doing wrong? Thanks

using System;
using Antlr4.Runtime; 

namespace test {
  public class Program {
    public static void Main(string[] args) {
      Console.WriteLine(new AntlrInputStream("Test"));
    }
  }
}
@formulahendry
Copy link
Owner

Could you share the screenshot of the output?

Code Runner supports two types of C# project:

  • .NET Core project: you need Run Code from .csproj file
  • csx (C# script): you need instal http://scriptcs.net/

@dhowe
Copy link
Author

dhowe commented Dec 27, 2017

Thanks! I'm just trying to create a basic console app for .NET core. You can see below that my executorMap is set to use mcs and mono on the current file, which I'm guessing is not correct, as it doesn't know about the package location for antlr...

Is there a simple example I can reference that uses 'run code' from .csproj (ideally with one or more nuget packages)?

image

@formulahendry
Copy link
Owner

I am not familiar with Mono. I guess you need another command to do nuget restore.
However, if you are using .NET Core: https://www.microsoft.com/net/download/windows You could simply run your project with dotnet run: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-run?tabs=netcore2x It will help you restore NuGet dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants