GithubHelp home page GithubHelp logo

Comments (3)

kaby76 avatar kaby76 commented on July 28, 2024

Please provide:

  • Your .csproj.
  • Output from dotnet publish "./ProjectFolder/MyProject.csproj" --no-restore -c Release -v diag.

from antlr4buildtasks.

MJLHThomassenHadrian avatar MJLHThomassenHadrian commented on July 28, 2024

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:

builder.log

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.

MJLHThomassenHadrian avatar MJLHThomassenHadrian commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.