[grep] [C#] Can't change the project structure

I would like to change the project structure to:

grep.sln
src/grep/grep.csproj
src/test/test.csproj

I changed the your_program.sh and .codecrafters/compile.sh files so that they only build src/grep/grep.csproj.
This approach worked with the interpreter challenge. However, for this grep challenge, I get the following error:

remote: [build] Step 10 complete.
remote: [build] Error: failed to calculate checksum of ref v0oay9i9vljk0pfrxkj9avnts::pvzc6j96ruchs2anutxvy4mz9: “/codecrafters-grep.csproj”: not found.

Hey @PolarGoose, could you try this minimal workaround for now?

Let me know if that resolves the issue!

@andy1li,

I’m not sure it works.
I have added a dummy, non-valid codecrafters-grep.csproj file at the root of the repository.
I get the following error:

remote: [build] > /app/codecrafters-grep.csproj(1,1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.
remote: [build] >
remote: [build]^[[0m > Build FAILED.
remote: [build] >
remote: [build] > /app/codecrafters-grep.csproj(1,1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.
remote: [build] >     0 Warning(s)
remote: [build] >     1 Error(s)
remote: [build] >
remote: [build] > Time Elapsed 00:00:00.16
remote: [build] Error: process "/bin/sh -c dotnet build --configuration Release ." did not complete successfully: exit code: 1.

The server tries to run /bin/sh -c dotnet build --configuration Release . command. This command is hardcoded and not coming from your_program.sh or .codecrafters/compile.sh.

I think it is a bug in the server build pipeline.
.codecrafters/compile.sh must be executed instead of a hardcoded command.

1 Like

@PolarGoose Could you try removing all invalid .csproj files and using a valid one like the screenshot in my previous reply?

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
  </PropertyGroup>
</Project>

In the meantime, we’ll work on adjusting the Dockerfile to better handle this.

Could you try removing all invalid .csproj files and using a valid one like the screenshot in my previous reply?

Yes, it works. Thus, it can indeed be used as a workaround.

In the meantime, we’ll work on adjusting the Dockerfile to better handle this.

Great.

Thank you for your help.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.