dotnet --info output:
Ferramentas de Linha de Comando do .NET (2.0.0)
Product Information:
Version: 2.0.0
Commit SHA-1 hash: cdcd1928c9
Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.0.0\
Microsoft .NET Core Shared Framework Host
Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
VS Code version: 1.17.0
C# Extension version: 1.12.0 (I think)
The attached project uses <Compile Include="$(IntermediateOutputPath)\*.cs" /> so GrammarParser is recognized. But usage of Compile causes others problems in Problems view and with dotnet cli.
If I remove Compile the project builds correctly with dotnet cli, but then OmniSharp does not recognize GrammarParser.
Many thanks for the detailed repro! I can definitely reproduce with this project.
Thanks again for the repro project. I have found the cause of the issue. We are failing to set the BuildingInsideVisualStudio in OmniSharp, which causes the Antlr targets to fail to include the generated files.
You can workaround this problem by setting BuildingInsideVisualStudio as an environment variable. Here's what I did from a Visual Studio Command Prompt.
> set BuildingInsideVisualStudio=true
> code .
No errors!
OK. I have a fixed checked into OmniSharp to address this issue. It turned out to not be the same root cause as https://github.com/OmniSharp/omnisharp-vscode/issues/1531, so I appreciate you taking the time to file this with an excellent repro.
Once we take a new release of OmniSharp into C# for VS Code, I'll close this issue.
> set BuildingInsideVisualStudio=true
> code .
I confirm this works when the files are already in obj, created by dotnet build.
But if I clean obj, should OmniSharp also cause the files to be generated? Currently it is not.
It won't generate the files simply by passing that variable, but it will with my full OmniSharp change. The project needs to be restored first though. There is an issue in OmniSharp where it won't reload a project after a restore in some cases (and this is one of them). However, if the project is already restored, the files will be generated when OmniSharp loads the project. I just tried this to verify.
@asfernandes : I just wanted to let you know that I just released on a new beta of C# for VS Code that fixes this issue: 1.3.0-beta5. You can following these instructions if you're interested in trying it out.
Seems working. It does not update generated files automatically when I save .g4 files, but it updates when I run the build target in vscode.
Correct. It will only regenerate the files when MSBuild runs. That happens on initial project loading and during build.