Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

弃用多个包,仅使用单一全功能包(避免开发者难维护,用户难选) #4

Merged
merged 23 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
7.0.x
8.0.x

- name: Build with dotnet
run: dotnet build --configuration Release
run: dotnet build --configuration release

- name: Test
run: dotnet test --configuration Release
# No need because all tests passed if the solution is successfully built
# - name: Test
# run: dotnet test --configuration release
40 changes: 0 additions & 40 deletions .github/workflows/nuget-master-publish.yml

This file was deleted.

15 changes: 6 additions & 9 deletions .github/workflows/nuget-tag-publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: publish nuget

on:
on:
push:
tags:
- '*'
Expand All @@ -17,10 +17,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
7.0.x
8.0.x

- name: Install dotnet tool
run: dotnet tool install -g dotnetCampus.TagToVersion
Expand All @@ -30,8 +27,8 @@ jobs:

- name: Build with dotnet
run: |
dotnet build --configuration Release
dotnet pack --configuration Release --no-build
dotnet build --configuration release
dotnet pack --configuration release --no-build

- name: Install Nuget
uses: nuget/setup-nuget@v1
Expand All @@ -44,5 +41,5 @@ jobs:

- name: Push generated package to GitHub registry
run: |
nuget push .\bin\Release\*.nupkg -Source github -SkipDuplicate
nuget push .\bin\Release\*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NugetKey }}
nuget push .\artifacts\package\release\*.nupkg -Source github -SkipDuplicate
nuget push .\artifacts\package\release\*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NugetKey }}
44 changes: 40 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Ignore Visual Studio temporary files, build results, and
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

# User-specific files
*.rsuser
Expand Down Expand Up @@ -29,7 +29,6 @@ x86/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/

Expand Down Expand Up @@ -91,6 +90,7 @@ StyleCopReport.xml
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
Expand Down Expand Up @@ -294,6 +294,17 @@ node_modules/
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp

# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp

# Visual Studio 6 technical files
*.ncb
*.aps

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
Expand Down Expand Up @@ -350,6 +361,9 @@ ASALocalRun/
# Local History for Visual Studio
.localhistory/

# Visual Studio History (VSHistory) files
.vshistory/

# BeatPulse healthcheck temp database
healthchecksdb

Expand All @@ -360,4 +374,26 @@ MigrationBackup/
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd

# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp

# JetBrains Rider
.idea/
*.sln.iml
32 changes: 18 additions & 14 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,34 @@

<Import Project="build\Version.props" />

<!-- 框架和语言信息 -->
<PropertyGroup>

<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<Deterministic>true</Deterministic>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<ArtifactsPath>$(MSBuildThisFileDirectory)artifacts</ArtifactsPath>
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
</PropertyGroup>

<PropertyGroup>
<!--
NETSDK1138: 目标框架 netxx 不受支持,将来不会收到安全更新。
NU5100: 程序集不在 lib 文件夹内
NU5100: 程序集不在 lib 文件夹内。
NU5128: 依赖的框架没有完全匹配项。
-->
<NoWarn>$(NoWarn);NETSDK1138;NU5100</NoWarn>
<NoWarn>$(NoWarn);NETSDK1138;NU5100;NU5128</NoWarn>
</PropertyGroup>

<PackageOutputPath>$(MSBuildThisFileDirectory)bin\$(Configuration)</PackageOutputPath>
<Company>dotnet campus(.NET 职业技术学院)</Company>
<!--库信息 -->
<PropertyGroup>
<Description>提供统一的日志记录方法。使用源生成器允许库的作者在不依赖本日志库的情况下完成日志的记录,并且还能对接到产品中完成日志的统一输出。</Description>
<Authors>dotnet-campus</Authors>
<Company>dotnet campus(.NET 职业技术学院)</Company>
<Copyright>Copyright © 2023-2024 dotnet campus, All Rights Reserved.</Copyright>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/dotnet-campus/dotnetCampus.LatestCSharpFeatures</RepositoryUrl>
<PackageProjectUrl>https://github.com/dotnet-campus/dotnetCampus.LatestCSharpFeatures</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
<Copyright>Copyright © 2023 dotnet campus, All Rights Reserved.</Copyright>

</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all"/>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
</ItemGroup>

</Project>
</Project>
44 changes: 17 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,37 @@
# Latest CSharp Features

| Language |
| --- |
| Language |
| ---------------------------------- |
| [简体中文](/docs/README.zh-CHS.md) |
| [繁體中文](/docs/README.zh-CHT.md) |
| [English](/README.md) |
| [日本語](/docs/README.jp.md) |
| [English](/README.md) |

This open-source project provides a series of NuGet packages that allow you to use the latest C# language features in older versions of .NET (including older .NET Framework, .NET Standard, as well as older .NET Core App, .NET).
[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.LatestCSharpFeatures.svg)](https://www.nuget.org/packages/dotnetCampus.LatestCSharpFeatures)

## NuGet Packages

We currently offer 8 NuGet packages for you to choose from based on your needs.

|Package Name|Function|Link|
|---|---|---|
|dotnetCampus.LatestCSharpFeatures|All-in-one package, includes all new C# features|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.LatestCSharpFeatures.svg)](https://www.nuget.org/packages/dotnetCampus.LatestCSharpFeatures)|
|dotnetCampus.LatestCSharpFeatures.Source|Source code version of the all-in-one package|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.LatestCSharpFeatures.Source.svg)](https://www.nuget.org/packages/dotnetCampus.LatestCSharpFeatures.Source)|
|dotnetCampus.IsExternalInit|Supports the use of init syntax|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.IsExternalInit.svg)](https://www.nuget.org/packages/dotnetCampus.IsExternalInit)|
|dotnetCampus.IsExternalInit.Source|Source code version that supports the use of init syntax|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.IsExternalInit.Source.svg)](https://www.nuget.org/packages/dotnetCampus.IsExternalInit.Source)|
|dotnetCampus.Nullable|Supports the use of rich nullable features|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Nullable.svg)](https://www.nuget.org/packages/dotnetCampus.Nullable)|
|dotnetCampus.Nullable.Source|Source code version that supports the use of rich nullable features|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Nullable.Source.svg)](https://www.nuget.org/packages/dotnetCampus.Nullable.Source)|
|dotnetCampus.Required|Adds support for the required syntax*|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Required.svg)](https://www.nuget.org/packages/dotnetCampus.Required)|
|dotnetCampus.Required.Source|Source code version that adds support for the required syntax*|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Required.Source.svg)](https://www.nuget.org/packages/dotnetCampus.Required.Source)|

\* For an introduction to the required syntax, you can refer to this [description](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/required)【7†source】【9†source】.
This open-source project provides a NuGet package, dotnetCampus.LatestCSharpFeatures, which allows you to use the latest C# language features in older versions of .NET, including the old .NET Framework, .NET Standard, and older versions of .NET Core App and .NET.

## How to Use

For both the all-in-one package and the single-feature packages, we provide two versions. Packages without the .Source suffix will generate a dll, so all projects that reference this project can use these new features. Packages with the .Source suffix are only effective for the project where the package is installed, and there are no additional dlls in the final generated project.
Simply install the dotnetCampus.LatestCSharpFeatures NuGet package.

```xml
<!-- Since dotnetCampus.LatestCSharpFeatures only contains source generators, it does not introduce any runtime dependencies.
We can set it to PrivateAssets="all" to avoid passing it on to other projects. -->
<PackageReference Include="dotnetCampus.LatestCSharpFeatures" Version="12.0.0" PrivateAssets="all" />
```

If you want the .Source package to be effective for other projects that reference this project, you can add a conditional compilation symbol in the csproj file:
If you want these new language features to also be effective for other projects that reference this project, you can add a conditional compilation symbol in the csproj file:

```xml
<!-- By default, installing packages with a .Source suffix imports the new C# features into the current project as internal.
By using this conditional compilation symbol, these types can be set as public, allowing other projects referencing this project to also use these new features. -->
<!-- By default, dotnetCampus.LatestCSharpFeatures introduces new C# features into the current project using the internal modifier.
By using this conditional compilation symbol, these types can be set to public, allowing other projects referencing this project to also use these new features. -->
<DefineConstants>$(DefineConstants);USE_PUBLIC_LATEST_CSHARP_FEATURES</DefineConstants>
```

## Feedback and Contributions

We welcome feedback and contributions from all users. If you encounter any problems during use, or have any suggestions for improvement, you can submit them via GitHub Issues.
We welcome feedback and contributions from all users. If you encounter any problems during use, or have any suggestions for improvements, you can submit them via GitHub Issues.

If you wish to participate in the development of the project, you are very welcome! You can Fork this repository and then submit a Pull Request.
If you wish to participate in the development of the project, you are also very welcome! You can Fork this repository and then submit a Pull Request.

Thank you for your support and help with dotnetCampus.LatestCSharpFeatures!
5 changes: 3 additions & 2 deletions build/Version.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project>
<PropertyGroup>
<Version>11.0.0</Version>
<!-- 此版本号仅作标记使用,标记当前支持的最新 C# 版本 -->
<Version>12.0.0</Version>
</PropertyGroup>
</Project>
</Project>
47 changes: 0 additions & 47 deletions docs/README.jp.md

This file was deleted.

Loading
Loading