Comments (3)
Please provide:
- Your .csproj.
- Output from
dotnet publish "./ProjectFolder/MyProject.csproj" --no-restore -c Release -v diag
.
from antlr4buildtasks.
My csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Antlr4 Include="MyLexer.g4">
<Listener>false</Listener>
<Visitor>true</Visitor>
<Package>MyNamespace</Package>
</Antlr4>
<Antlr4 Include="MyParser.g4">
<Listener>false</Listener>
<Visitor>true</Visitor>
<Package>MyNamespace</Package>
</Antlr4>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Antlr4.Runtime.Standard" Version="4.13.1" />
<PackageReference Include="Antlr4BuildTasks" Version="12.8.0" PrivateAssets="all" />
<PackageReference Include="LinqKit.Microsoft.EntityFrameworkCore" Version="8.1.5" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SomeOtherProject.csproj" />
</ItemGroup>
</Project>
dotnet publish
output:
I've 'redacted' some sensitive names as this is a project for my company, but the setup is identical to what we have.
What i noticed is that, even though this is executed inside a docker container, on line 2646 you see:
Task "ReadLinesFromFile" (TaskId:2)
#10 1.814 Task Parameter:File=obj/Release/net8.0/MyProject.csproj.AntlrToCompileList.txt (TaskId:2)
#10 1.819 Output Item(s):
#10 1.819 ToCompileFiles=
#10 1.819 C:/Users/<myuser>/Documents/ProjectFolder/MyProject/obj/Release/net8.0/MyLexer.cs
#10 1.819 C:/Users/<myuser>/Documents/ProjectFolder/MyProject/obj/Release/net8.0/MyParser.cs
#10 1.819 C:/Users/<myuser>/Documents/ProjectFolder/MyProject/obj/Release/net8.0/MyParserBaseListener.cs
#10 1.819 C:/Users/<myuser>/Documents/ProjectFolder/MyProject/obj/Release/net8.0/MyParserBaseVisitor.cs
#10 1.819 C:/Users/<myuser>/Documents/ProjectFolder/MyProject/obj/Release/net8.0/MyParserListener.cs
#10 1.819 C:/Users/<myuser>/Documents/ProjectFolder/MyProject/obj/Release/net8.0/MyParserVisitor.cs (TaskId:2)
Which is wierd, i would expect the paths there to be the paths in the docker container, not my local hard drive. This repeats further on in the logs.
For reference, the dockerfile looks like this:
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /
COPY ./ ./
RUN dotnet restore
RUN dotnet publish "./MyProject/MyProject.csproj" --no-restore -c Release -v diag
EDIT: I noticed docker cut off the log file so it might be incomplete. I'm trying to set up a minimal example that shows the issue, however, a very basic project setup with just 1 csproj file does seem to work, so im trying to see where the issue could be.
from antlr4buildtasks.
Ok, i found the issue, it is a user error, sorry for bothering you (although your suggestion of printing diagnostic info did help me trace down the issue).
The problem was that both on our build agent AND locally, i already ran dotnet build -c Release
before triggering the docker file. The Docker file's COPY step copies all files into the docker container, including the build files. When docker build runs, it takes the MyProject.csproj.AntlrToCompileList.txt
file from the obj/Release/net8.0 directory instead of generating a new one. dotnet clean
did not clean this directory, so the build inside docker just took the cached files, which have the wrong paths (paths from build outside docker).
Just deleting the obj folder and then running the docker build fixed the issue.
from antlr4buildtasks.
Related Issues (20)
- Error MSB3231: Directory %documents%/.jre cannot be deleted HOT 26
- Big performance hit after switch from `Antlr4.CodeGenerator` to `Antlr4BuildTasks` and `Antlr4.Runtime.Standard` HOT 3
- 64 bit version of functions? HOT 1
- Concurrency access to JAR file
- error ANT02: Went through the complete probe list looking for an Antlr4 tool jar, but could not find anything. Fail! HOT 2
- Error ANT02: Cannot find Java executable'' in .NET SDK Docker Image HOT 3
- Transitive Dependency Vulnerability HOT 3
- Cannot use `partial` to complement parser/lexer (unless namespace is explicitly specified) HOT 2
- Nuget has contains debug build HOT 6
- UnbufferedCharStream HOT 1
- Is MSBuild truly necesary? HOT 5
- WebClient is obsolete HOT 1
- 'JRE file used by another process' error when building through Azure DevOps HOT 13
- M2 Mac JDK Download Support HOT 2
- M2 Mac JDK Download Support HOT 1
- Creates parser that uses wrong fieldname when referencing field causing CS1001. HOT 1
- Questions about syntax parsing HOT 2
- Allowing empty string in lexer islands? HOT 5
- Build runs on every compile HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from antlr4buildtasks.