Skip to content

Commit

Permalink
Merge pull request #72 from codecrafters-io/CC-1541
Browse files Browse the repository at this point in the history
CC-1541: Update .NET version to 9.0
  • Loading branch information
ryan-gang authored Dec 12, 2024
2 parents 87e0819 + de5b834 commit 67c43f3
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion compiled_starters/csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Time to move on to the next stage!

Note: This section is for stages 2 and beyond.

1. Ensure you have `dotnet (8.0)` installed locally
1. Ensure you have `dotnet (9.0)` installed locally
1. Run `./your_program.sh` to run your program, which is implemented in
`src/Server.cs`.
1. Commit your changes and run `git push origin master` to submit your solution
Expand Down
2 changes: 1 addition & 1 deletion compiled_starters/csharp/codecrafters-dns-server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>codecrafters_dns_server</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
4 changes: 2 additions & 2 deletions compiled_starters/csharp/codecrafters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ debug: false
# Use this to change the C# version used to run your code
# on Codecrafters.
#
# Available versions: dotnet-8.0
language_pack: dotnet-8.0
# Available versions: dotnet-9.0
language_pack: dotnet-9.0
24 changes: 24 additions & 0 deletions dockerfiles/dotnet-9.0.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine

COPY codecrafters-dns-server.csproj /app/codecrafters-dns-server.csproj
COPY codecrafters-dns-server.sln /app/codecrafters-dns-server.sln

RUN mkdir /app/src
RUN (echo 'System.Console.WriteLine("If you are seeing this, there is something wrong with our caching mechanism! Please contact us at [email protected].");' > /app/src/Program.cs) > /dev/null

WORKDIR /app

# This saves nuget packages to ~/.nuget
RUN dotnet build --configuration Release .

# Overwrite Program.cs to remove the echoed line
RUN rm /app/src/Program.cs

# This seems to cause a caching issue with the dotnet build command, where contents from the removed /src/Program.cs are used
RUN rm -rf /app/obj
RUN rm -rf /app/bin

RUN echo "cd \${CODECRAFTERS_REPOSITORY_DIR} && dotnet build --configuration Release ." > /codecrafters-precompile.sh
RUN chmod +x /codecrafters-precompile.sh

ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="codecrafters-dns-server.csproj,codecrafters-dns-server.sln"
2 changes: 1 addition & 1 deletion solutions/csharp/01-ux2/code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Time to move on to the next stage!

Note: This section is for stages 2 and beyond.

1. Ensure you have `dotnet (8.0)` installed locally
1. Ensure you have `dotnet (9.0)` installed locally
1. Run `./your_program.sh` to run your program, which is implemented in
`src/Server.cs`.
1. Commit your changes and run `git push origin master` to submit your solution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>codecrafters_dns_server</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
4 changes: 2 additions & 2 deletions solutions/csharp/01-ux2/code/codecrafters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ debug: false
# Use this to change the C# version used to run your code
# on Codecrafters.
#
# Available versions: dotnet-8.0
language_pack: dotnet-8.0
# Available versions: dotnet-9.0
language_pack: dotnet-9.0
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>codecrafters_dns_server</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
2 changes: 1 addition & 1 deletion starter_templates/csharp/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
attributes:
required_executable: dotnet (8.0)
required_executable: dotnet (9.0)
user_editable_file: src/Server.cs

0 comments on commit 67c43f3

Please sign in to comment.