Skip to content

Commit

Permalink
self contained and trimmed dotnet 7 #146
Browse files Browse the repository at this point in the history
  • Loading branch information
christiannagel committed Nov 14, 2022
1 parent 7f94f8b commit 3f63bcc
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
17 changes: 11 additions & 6 deletions 1_CS/HelloWorld/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,25 @@ Please check my blog [csharp.christiannagel.com](https://csharp.christiannagel.c

Thank you!

## Updates with C# 10
## Updates with C# 10 and C# 11

See [Updates with C# 10](../..Dotnet6Updates.md)
* See [Updates with C# 10 and .NET 6](../..Dotnet6Updates.md)
* See [Updates with C# 11 and .NET 7]../../Dotnet7Updates.md)

To see all templates available with `dotnet new`:

> dotnet new --list
> dotnet new list
With .NET 7, *--list* is deprecated (but still works), and *list* should be used instead.

### Self Contained Hello World

Page 22 - The option --self-contained is now required with .NET 6:
[.NET Runtime Identifier Catalog](https://docs.microsoft.com/dotnet/core/rid-catalog?WT.mc_id=DT-MVP-10160)

Page 22 - The option --self-contained is now required with (since .NET 6):

```
dotnet publish --self-contained -c Release -r win10-x64
dotnet publish --self-contained -c Release -r osx.10.11-x64
dotnet publish --self-contained -c Release -r ubuntu-x64
dotnet publish --self-contained -c Release -r osx.10.13-x64
dotnet publish --self-contained -c Release -r linux-x64
```
9 changes: 5 additions & 4 deletions 1_CS/HelloWorld/SelfContainedHelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifiers>
win10-x64;ubuntu-x64;osx.10.11-x64;
</RuntimeIdentifiers>
</PropertyGroup>

<PropertyGroup>
<RuntimeIdentifiers>win10-x64;linux-x64;osx.10.13-x64</RuntimeIdentifiers>
</PropertyGroup>

</Project>
3 changes: 2 additions & 1 deletion 1_CS/HelloWorld/SelfContainedHelloWorld/Program.cs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Console.WriteLine("Hello, World!");
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
10 changes: 6 additions & 4 deletions 1_CS/HelloWorld/TrimmedHelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RuntimeIdentifiers>
win10-x64;ubuntu-x64;osx.10.11-x64;
</RuntimeIdentifiers>
</PropertyGroup>

<PropertyGroup>
<RuntimeIdentifiers>win10-x64;linux-x64;osx.10.13-x64</RuntimeIdentifiers>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>link</TrimMode>
</PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion 1_CS/HelloWorld/TrimmedHelloWorld/Program.cs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Console.WriteLine("Hello, World!");
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
Binary file not shown.

0 comments on commit 3f63bcc

Please sign in to comment.