-
Notifications
You must be signed in to change notification settings - Fork 104
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
Unable to set Antlr4 Build Action in .Net Core 2 project in Visual Studio 2017 #250
Comments
It looks like your project does not contain any reference to ANTLR 4. You'll need to reference two packages in order to compile a project with a grammar:
📝 The Antlr4 package is a metadata package that allows you to reference both of the above using a single reference. Adding the following to your project file should resolve the issue: <PropertyGroup>
<!-- See the release notes for 4.6.5-beta001 for an explanation of this optional property -->
<Antlr4UseCSharpGenerator>True</Antlr4UseCSharpGenerator>
</PropertyGroup>
<ItemGroup>
<!-- This is the required reference which is missing from your project file -->
<PackageReference Include="Antlr4" Version="4.6.5-beta001" />
</ItemGroup> |
I have modified my
|
Hi @sharwell , Gotcha, I installed
However, I am still not seeing the parser and lexer file. Do I still need to add anything in csproj file? |
They are part of the build, but not visible in Solution Explorer. If you create a new class you'll be able to use them just fine. 😄 |
@sharwell ,
in |
Modifying this property should not cause any problems for the code generator. If it did, then it sounds like you found a bug.
Can you be more specific? |
I have created a .Net Core 2 project and wanted to add Grammar.g4 file. I have added Nuget packages called "ANtlr4", "Antlr4.Runtime" and "Antlr4.CodeGenerator" with latest available version 4.6.4. Somehow, I am not able to change "Build Action" to Antlr4 for my Grammar.g4 file. Because of that, it's not generating parser and lexer files. Can anyone please help here what's wrong going on?
I tried to modify
csproj
file manually but still it didn't generate lexer and parser file.The text was updated successfully, but these errors were encountered: