Skip to content

Commit

Permalink
CC-1541: Update .NET version to 9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-gang committed Dec 9, 2024
1 parent ba3628d commit eaf1ad7
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 7 deletions.
2 changes: 1 addition & 1 deletion compiled_starters/csharp/codecrafters-git.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_git</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
26 changes: 26 additions & 0 deletions dockerfiles/dotnet-9.0.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine

RUN apk add --no-cache 'git>=2.40'

COPY codecrafters-git.csproj /app/codecrafters-git.csproj
COPY codecrafters-git.sln /app/codecrafters-git.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-git.csproj,codecrafters-git.sln"
2 changes: 1 addition & 1 deletion solutions/csharp/01-gg4/code/codecrafters-git.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_git</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
4 changes: 2 additions & 2 deletions solutions/csharp/01-gg4/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
2 changes: 1 addition & 1 deletion starter_templates/csharp/code/codecrafters-git.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_git</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down

0 comments on commit eaf1ad7

Please sign in to comment.