Skip to content

Commit

Permalink
Support .NET 6
Browse files Browse the repository at this point in the history
  • Loading branch information
thohng committed Nov 10, 2021
1 parent 3849950 commit 3ce8258
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<FrameworkVersion>5.0.10</FrameworkVersion>
<FrameworkBaselineVersion Condition="'$(TargetFramework)' != 'net5.0' And '$(TargetFramework)' != 'net6.0'">3.1.0</FrameworkBaselineVersion>
<FrameworkBaselineVersion Condition="'$(TargetFramework)' == 'net5.0'">5.0.0</FrameworkBaselineVersion>
<FrameworkBaselineVersion Condition="'$(TargetFramework)' == 'net6.0'">6.*-*</FrameworkBaselineVersion>
<FrameworkBaselineVersion Condition="'$(TargetFramework)' == 'net6.0'">6.0.0</FrameworkBaselineVersion>
</PropertyGroup>

<ItemGroup>
<!--build related-->
<PackageReference Include="MinVer" Condition="'$(TargetFramework)' != 'net6.0'" Version="2.*" PrivateAssets="All" />
<PackageReference Include="MinVer" Condition="'$(TargetFramework)' == 'net6.0'" Version="3.*-*" PrivateAssets="All" />
<PackageReference Update="Microsoft.SourceLink.Gitea" Version="1.*-*" PrivateAssets="All" />
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.0.*" PrivateAssets="All" />
<PackageReference Update="Microsoft.SourceLink.Gitea" Version="1.*" PrivateAssets="All" />
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.*" PrivateAssets="All" />

<!--the netlah platform-->
<PackageReference Update="NetLah.Abstractions" Version="[0.*,1.0)" PrivateAssets="build" />
Expand All @@ -26,7 +26,7 @@
<PackageReference Update="coverlet.collector" Version="3.*" PrivateAssets="All" />
<PackageReference Update="NUnit" Version="3.*" />
<PackageReference Update="NUnit3TestAdapter" Version="3.*" PrivateAssets="All" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.*" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.*" />
<PackageReference Update="Moq" Version="4.*" />
<PackageReference Update="TeamCity.VSTest.TestAdapter" Version="1.*" />
<PackageReference Update="xunit" Version="2.*" />
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ This solution come from the idea of [Gérald Barré on Meziantou's blog Getting

```xml
<ItemGroup>
<PackageReference Include="NetLah.Abstractions" Version="0.1.1" />
<PackageReference Include="NetLah.Abstractions" Version="0.2.0" />
</ItemGroup>
```

### 2. Output during build

```txt
Microsoft (R) Build Engine version 17.0.0-preview-21501-01+bbcce1dff for .NET
Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
SampleApp -> C:\Work\NetLah\abstractions\samples\SampleApp\bin\Debug\net6.0\SampleApp.dll
SampleApp := [set] 2021-10-14T04:26:28 (net6.0)
SampleApp := [set] 2021-11-08T21:26:28 (net6.0)
Build succeeded.
0 Warning(s)
Expand All @@ -52,7 +52,7 @@ The output:

```text
AssemblyTitle:NetLah.Abstractions
Version:0.0.0-alpha.0.1 BuildTime:2021-10-14T12:26:28+08:00; Framework:.NETStandard,Version=v2.0
Version:0.2.0-rc2.2 BuildTime:2021-11-08T21:26:28+08:00; Framework:.NETStandard,Version=v2.0
```

### 3. Or Retrieve build datetime of entry assembly
Expand All @@ -67,7 +67,7 @@ Output:

```text
AppTitle:SampleApp
Version:0.0.0-alpha.0.1 BuildTime:2021-10-14T12:26:56+08:00; Framework:.NETCoreApp,Version=v6.0
Version:0.2.0-rc2.2 BuildTime:2021-11-08T21:26:56+08:00; Framework:.NETCoreApp,Version=v6.0
```

### 4. Use `Directory.Build.targets` to declare build date attribute to all projects inside the solution
Expand All @@ -76,7 +76,7 @@ Version:0.0.0-alpha.0.1 BuildTime:2021-10-14T12:26:56+08:00; Framework:.NETCoreA

```xml
<ItemGroup>
<PackageReference Update="NetLah.Abstractions" Version="0.1.1" />
<PackageReference Update="NetLah.Abstractions" Version="0.2.0" />
</ItemGroup>
```

Expand All @@ -85,6 +85,6 @@ Version:0.0.0-alpha.0.1 BuildTime:2021-10-14T12:26:56+08:00; Framework:.NETCoreA
```xml
<ItemGroup>
<PackageReference Include="NetLah.Abstractions" />
<PackageReference Update="NetLah.Abstractions" Version="0.1.1" />
<PackageReference Update="NetLah.Abstractions" Version="0.2.0" />
</ItemGroup>
```

0 comments on commit 3ce8258

Please sign in to comment.