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

Cannot use both Antlr4.Runtime and Antlr4.Runtime.Standard in same project #32

Closed
danieln-cx opened this issue May 12, 2022 · 2 comments

Comments

@danieln-cx
Copy link

I was using Antlr4BuildTasks 8.17.0 with Antlr4.Runtime.Standard 4.9.3 in a project that also referenced the "old" Antlr4.Runtime 4.6.6 and everything worked fine. I was able to maintain both nugets without namespace conflicts in the code by using an alias with the later:

<PackageReference Include="Antlr4.Runtime" Version="4.6.6">
   <Aliases>Antlr4Legacy</Aliases>
   <PrivateAssets>contentfiles;analyzers;build;compile</PrivateAssets>
</PackageReference>

I wont get into the reasons why I have such setup, but it used to work.
When trying to update to Antlr4.Runtime.Standard 4.10.1 and Antlr4BuildTasks 10.3.0 this stopped working and I have the following message:

You are referencing Antlr4.Runtime in your .csproj file. This build tool can only reference the NET Standard library https://www.nuget.org/packages/Antlr4.Runtime.Standard/. You can only use either the 'official' Antlr4 or the 'tunnelvision' fork, but not both. You have to choose one.

Since there is a way for this to work, can you remove such error? Or provide a way to make it still work?

Thanks!

@kaby76
Copy link
Owner

kaby76 commented May 13, 2022

Hi, I updated the code to offer an option in the csproj/UI to bypass the check for Antlr4.Runtime. To bypass the check, set <AllowAntlr4cs>true</AllowAntlr4cs> in the csproj or use the VSIDE to set the option through the UI. You will still need to do the aliasing in the csproj you show above. The change is In version 10.4 which I just pushed to nuget.org. --Ken

@danieln-cx
Copy link
Author

That was amazingly fast @kaby76! Thank you very much 😀

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

2 participants