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

Antlr4 + VS2017 + .Net Core #352

Open
RobertWalterU3d opened this issue Jul 3, 2020 · 0 comments
Open

Antlr4 + VS2017 + .Net Core #352

RobertWalterU3d opened this issue Jul 3, 2020 · 0 comments

Comments

@RobertWalterU3d
Copy link

Hello,

I try to create a DLL that contains a Lexer and Parser generated by Antlr4 and that will work with .NET Core.

For this, I followed the guide to setup VS 2017 to use Antlr4. I created a new .Net Core class library project and added Antlr 4.6.6 via NuGet package manager.
However, when building the project (i.e. generating the Lexer and Parser), I get a bunch of build errors since the Antlr4 namespace cannot be resolved in the generated files.

I found this old issue and when I add explicit PackageReferences to the Antrl runtime, the generated cs files can be compiled fine.

<PackageReference Include="Antlr4.Runtime" Version="4.6.6" />

Is it still the recommended way to manually add the PackageReference to the CSPROJ file, or is there a better way?

Also, in the mentioned issue, the CodeGenerator is also manually added as a PackageReference. At least I don't need it to rid myself of the build errors, but maybe I still need it later?

<PackageReference Include="Antlr4.CodeGenerator" Version="4.6.6" PrivateAssets="all" />

Any help is appreciated.

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

No branches or pull requests

1 participant