Skip to content

Commit 1a779dc

Browse files
authored
Merge pull request #1 from dotnet-campus/t/walterlv/first
初步完成项目,打出 8 个包
2 parents 5fcf80c + 1133610 commit 1a779dc

37 files changed

Lines changed: 1587 additions & 1 deletion

.github/workflows/dotnet-build.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: .NET Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: windows-latest
9+
10+
steps:
11+
- uses: actions/checkout@v1
12+
13+
- name: Build with dotnet
14+
run: dotnet build --configuration Release
15+
16+
- name: Test
17+
run: dotnet test --configuration Release
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# 去掉注释可以合并 master 分支自动打包
2+
# 为什么不期望推送 master 自动打包?原因是打出来的 CBB 没有 Tag 不利于回滚找到代码
3+
4+
# name: publish nuget
5+
6+
# on:
7+
# push:
8+
# branches:
9+
# - master
10+
11+
# jobs:
12+
# build:
13+
14+
# runs-on: windows-latest
15+
16+
# steps:
17+
# - uses: actions/checkout@v1
18+
19+
# - name: Setup .NET Core
20+
# uses: actions/setup-dotnet@v1
21+
# with:
22+
# dotnet-version: 3.1.300
23+
24+
# - name: Build with dotnet
25+
# run: |
26+
# dotnet build --configuration Release
27+
# dotnet pack --configuration Release --no-build
28+
29+
# - name: Install Nuget
30+
# uses: nuget/setup-nuget@v1
31+
# with:
32+
# nuget-version: '5.x'
33+
34+
# - name: Add private GitHub registry to NuGet
35+
# run: |
36+
# nuget sources add -name github -Source https://nuget.pkg.github.com/dotnet-campus/index.json -Username dotnet-campus -Password ${{ secrets.GITHUB_TOKEN }}
37+
# - name: Push generated package to GitHub registry
38+
# run: |
39+
# nuget push .\bin\Release\*.nupkg -Source github -SkipDuplicate
40+
# nuget push .\bin\Release\*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NugetKey }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: publish nuget
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
11+
runs-on: windows-latest
12+
13+
steps:
14+
- uses: actions/checkout@v1
15+
16+
- name: Install dotnet tool
17+
run: dotnet tool install -g dotnetCampus.TagToVersion
18+
19+
- name: Set tag to version
20+
run: dotnet TagToVersion -t ${{ github.ref }}
21+
22+
- name: Build with dotnet
23+
run: |
24+
dotnet build --configuration Release
25+
dotnet pack --configuration Release --no-build
26+
27+
- name: Install Nuget
28+
uses: nuget/setup-nuget@v1
29+
with:
30+
nuget-version: '5.x'
31+
32+
- name: Add private GitHub registry to NuGet
33+
run: |
34+
nuget sources add -name github -Source https://nuget.pkg.github.com/dotnet-campus/index.json -Username dotnet-campus -Password ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Push generated package to GitHub registry
37+
run: |
38+
nuget push .\bin\Release\*.nupkg -Source github -SkipDuplicate
39+
nuget push .\bin\Release\*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NugetKey }}

Directory.Build.props

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<Project>
2+
3+
<Import Project="build\Version.props" />
4+
5+
<PropertyGroup>
6+
7+
<LangVersion>latest</LangVersion>
8+
<GenerateDocumentationFile>True</GenerateDocumentationFile>
9+
10+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
11+
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\$(Configuration)</PackageOutputPath>
12+
<Company>dotnet campus(.NET 职业技术学院)</Company>
13+
<Authors>dotnet-campus</Authors>
14+
<RepositoryUrl>https://github.com/dotnet-campus/dotnetCampus.LatestCSharpFeatures</RepositoryUrl>
15+
<PackageProjectUrl>https://github.com/dotnet-campus/dotnetCampus.LatestCSharpFeatures</PackageProjectUrl>
16+
<RepositoryType>git</RepositoryType>
17+
<Copyright>Copyright © 2023 dotnet campus, All Rights Reserved.</Copyright>
18+
19+
</PropertyGroup>
20+
21+
<ItemGroup>
22+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all"/>
23+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
24+
</ItemGroup>
25+
26+
</Project>

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) [year] [fullname]
3+
Copyright (c) 2023 dotnetCampus.LatestCSharpFeatures
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Latest CSharp Features
2+
3+
| Language |
4+
| --- |
5+
| [简体中文](/docs/README.zh-CHS.md) |
6+
| [繁體中文](/docs/README.zh-CHT.md) |
7+
| [English](/README.md) |
8+
| [日本語](/docs/README.jp.md) |
9+
10+
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).
11+
12+
## NuGet Packages
13+
14+
We currently offer 8 NuGet packages for you to choose from based on your needs.
15+
16+
|Package Name|Function|Link|
17+
|---|---|---|
18+
|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)|
19+
|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)|
20+
|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)|
21+
|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)|
22+
|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)|
23+
|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)|
24+
|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)|
25+
|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)|
26+
27+
\* 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】.
28+
29+
## How to Use
30+
31+
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.
32+
33+
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:
34+
35+
```xml
36+
<!-- By default, installing packages with a .Source suffix imports the new C# features into the current project as internal.
37+
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. -->
38+
<DefineConstants>$(DefineConstants);USE_PUBLIC_LATEST_CSHARP_FEATURES</DefineConstants>
39+
```
40+
41+
## Feedback and Contributions
42+
43+
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.
44+
45+
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.
46+
47+
Thank you for your support and help with dotnetCampus.LatestCSharpFeatures!
48+
49+
Note, you should still output this in a Markdown code block so I can directly copy this document.

build/Version.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project>
2+
<PropertyGroup>
3+
<Version>0.0.1-alpha01</Version>
4+
</PropertyGroup>
5+
</Project>

docs/README.jp.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# 最新のCSharpの特徴
2+
3+
| Language |
4+
| --- |
5+
| [简体中文](/docs/README.zh-CHS.md) |
6+
| [繁體中文](/docs/README.zh-CHT.md) |
7+
| [English](/README.md) |
8+
| [日本語](/docs/README.jp.md) |
9+
10+
このオープンソースプロジェクトは一連のNuGetパッケージを提供し、古いバージョンの.NET(古い.NET Framework、.NET Standard、古い.NET Core App、.NETを含む)で最新のC#言語の特徴を使用できます。
11+
12+
## NuGetパッケージ
13+
14+
現在、8つのNuGetパッケージを提供しており、必要に応じて選択してインストールできます。
15+
16+
|パッケージ名|機能|リンク|
17+
|---|---|---|
18+
|dotnetCampus.LatestCSharpFeatures|全機能パッケージ、すべての新しいC#機能が含まれています|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.LatestCSharpFeatures.svg)](https://www.nuget.org/packages/dotnetCampus.LatestCSharpFeatures)|
19+
|dotnetCampus.LatestCSharpFeatures.Source|全機能パッケージのソースコードバージョン|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.LatestCSharpFeatures.Source.svg)](https://www.nuget.org/packages/dotnetCampus.LatestCSharpFeatures.Source)|
20+
|dotnetCampus.IsExternalInit|init構文の使用をサポート|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.IsExternalInit.svg)](https://www.nuget.org/packages/dotnetCampus.IsExternalInit)|
21+
|dotnetCampus.IsExternalInit.Source|init構文の使用をサポートするソースコードバージョン|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.IsExternalInit.Source.svg)](https://www.nuget.org/packages/dotnetCampus.IsExternalInit.Source)|
22+
|dotnetCampus.Nullable|豊富なnull許容型の使用をサポート|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Nullable.svg)](https://www.nuget.org/packages/dotnetCampus.Nullable)|
23+
|dotnetCampus.Nullable.Source|豊富なnull許容型の使用をサポートするソースコードバージョン|[![NuGet](https://img.shields.io/nuget/v/dotnetCamp```
24+
us.Nullable.Source.svg)](https://www.nuget.org/packages/dotnetCampus.Nullable.Source)|
25+
|dotnetCampus.Required|required構文のサポートを追加*|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Required.svg)](https://www.nuget.org/packages/dotnetCampus.Required)|
26+
|dotnetCampus.Required.Source|required構文のサポートを追加するソースコードバージョン*|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Required.Source.svg)](https://www.nuget.org/packages/dotnetCampus.Required.Source)|
27+
28+
\* required構文の紹介については、ここでの[説明](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/required)を参照してください【7†source】【9†source】。
29+
30+
## 使用方法
31+
32+
全機能パッケージでも単一機能パッケージでも、2つのバージョンを提供しています。.Sourceサフィックスがないパッケージはdllを生成し、このプロジェクトを参照したすべてのプロジェクトでこれらの新機能を使用できます。一方、.Sourceサフィックスが付いたパッケージは、このパッケージをインストールしたプロジェクトにのみ有効で、最終的に生成されたプロジェクトには追加のdllがありません。
33+
34+
.Sourceパッケージをこのプロジェクトを参照した他のプロジェクトにも有効にしたい場合は、csprojファイルに条件付きコンパイルシンボルを追加できます:
35+
36+
```xml
37+
<!-- デフォルトでは、.Sourceの接尾辞が付いたパッケージをインストールすると、新しいC#の機能がinternalとして現在のプロジェクトにインポートされます。
38+
この条件コンパイル記号を使用すると、これらのタイプをpublicとして設定でき、このプロジェクトを参照している他のプロジェクトもこれらの新機能を使用できます。 -->
39+
<DefineConstants>$(DefineConstants);USE_PUBLIC_LATEST_CSHARP_FEATURES</DefineConstants>
40+
```
41+
42+
## フィードバックと貢献
43+
44+
すべてのユーザーからのフィードバックと貢献を歓迎します。何か問題が見つかった場合や改善の提案がある場合は、GitHub Issuesで提出してください。
45+
46+
プロジェクトの開発に参加したい場合も、大歓迎です!このリポジトリをフォークして、Pull Requestを提出できます。
47+
48+
dotnetCampus.LatestCSharpFeaturesへのご支援とご協力に感謝します!

docs/README.zh-CHS.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Latest CSharp Features
2+
3+
| Language |
4+
| --- |
5+
| [简体中文](/docs/README.zh-CHS.md) |
6+
| [繁體中文](/docs/README.zh-CHT.md) |
7+
| [English](/README.md) |
8+
| [日本語](/docs/README.jp.md) |
9+
10+
此开源项目提供一系列 NuGet 包,让您可以在旧版本的 .NET(包括旧的 .NET Framework、.NET Standard,以及旧的 .NET Core App、.NET)中,使用最新的 C# 语言特性。
11+
12+
## NuGet 包
13+
14+
我们目前提供 8 个 NuGet 包,您可以根据需要选择安装。
15+
16+
|包名|功能|链接|
17+
|---|---|---|
18+
|dotnetCampus.LatestCSharpFeatures|全功能包,包含所有 C# 新功能|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.LatestCSharpFeatures.svg)](https://www.nuget.org/packages/dotnetCampus.LatestCSharpFeatures)|
19+
|dotnetCampus.LatestCSharpFeatures.Source|全功能包的源代码版本|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.LatestCSharpFeatures.Source.svg)](https://www.nuget.org/packages/dotnetCampus.LatestCSharpFeatures.Source)|
20+
|dotnetCampus.IsExternalInit|支持使用 init 语法|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.IsExternalInit.svg)](https://www.nuget.org/packages/dotnetCampus.IsExternalInit)|
21+
|dotnetCampus.IsExternalInit.Source|支持使用 init 语法的源代码版本|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.IsExternalInit.Source.svg)](https://www.nuget.org/packages/dotnetCampus.IsExternalInit.Source)|
22+
|dotnetCampus.Nullable|支持使用丰富的可空支持|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Nullable.svg)](https://www.nuget.org/packages/dotnetCampus.Nullable)|
23+
|dotnetCampus.Nullable.Source|支持使用丰富的可空支持的源代码版本|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Nullable.Source.svg)](https://www.nuget.org/packages/dotnetCampus.Nullable.Source)|
24+
|dotnetCampus.Required|增加了 required 语法的支持*|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Required.svg)](https://www.nuget.org/packages/dotnetCampus.Required)|
25+
|dotnetCampus.Required.Source|增加了 required 语法支持的源代码版本*|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Required.Source.svg)](https://www.nuget.org/packages/dotnetCampus.Required.Source)|
26+
27+
\* 对于 required 语法的介绍,您可以参考这里的[说明](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/required)【7†source】【9†source】。
28+
29+
## 使用方法
30+
31+
无论是全功能包还是单一功能包,我们都提供了两种版本。不带 .Source 后缀的包会生成一个 dll,这样所有引用了这个项目的项目都能使用到这些新功能。而带有 .Source 后缀的包则只对安装此包的项目有效,最终生成的项目中没有额外的 dll。
32+
33+
如果您希望 .Source 包对其他引用了此项目的项目也生效,可以在 csproj 文件中增加一个条件编译符:
34+
35+
```xml
36+
<!-- 默认情况下,安装 .Source 后缀的包会将 C# 新特性以 internal 修饰符引入当前项目。
37+
使用此条件编译符,可以将这些类型设为 public,使得引用此项目的其他项目也能使用这些新特性。 -->
38+
<DefineConstants>$(DefineConstants);USE_PUBLIC_LATEST_CSHARP_FEATURES</DefineConstants>
39+
```
40+
41+
## 反馈与贡献
42+
43+
我们欢迎所有用户的反馈和贡献。如果你在使用过程中发现任何问题,或者有任何改进建议,都可以通过 GitHub Issues 提交。
44+
45+
如果你希望参与到项目的开发中,也非常欢迎!你可以 Fork 本仓库,然后提交 Pull Request。
46+
47+
感谢你对 dotnetCampus.LatestCSharpFeatures 的支持和帮助!

docs/README.zh-CHT.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# 最新的 CSharp 特性
2+
3+
| Language |
4+
| --- |
5+
| [简体中文](/docs/README.zh-CHS.md) |
6+
| [繁體中文](/docs/README.zh-CHT.md) |
7+
| [English](/README.md) |
8+
| [日本語](/docs/README.jp.md) |
9+
10+
此開源項目提供一系列 NuGet 包,讓您可以在舊版本的 .NET(包括舊的 .NET Framework、.NET Standard,以及舊的 .NET Core App、.NET)中,使用最新的 C# 語言特性。
11+
12+
## NuGet 包
13+
14+
我們目前提供 8 個 NuGet 包,您可以根據需要選擇安裝。
15+
16+
|包名|功能|連結|
17+
|---|---|---|
18+
|dotnetCampus.LatestCSharpFeatures|全功能包,包含所有 C# 新功能|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.LatestCSharpFeatures.svg)](https://www.nuget.org/packages/dotnetCampus.LatestCSharpFeatures)|
19+
|dotnetCampus.LatestCSharpFeatures.Source|全功能包的源碼版本|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.LatestCSharpFeatures.Source.svg)](https://www.nuget.org/packages/dotnetCampus.LatestCSharpFeatures.Source)|
20+
|dotnetCampus.IsExternalInit|支援使用 init 語法|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.IsExternalInit.svg)](https://www.nuget.org/packages/dotnetCampus.IsExternalInit)|
21+
|dotnetCampus.IsExternalInit.Source|支援使用 init 語法的源碼版本|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.IsExternalInit.Source.svg)](https://www.nuget.org/packages/dotnetCampus.IsExternalInit.Source)|
22+
|dotnetCampus.Nullable|支援使用豐富的可空支援|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Nullable.svg)](https://www.nuget.org/packages/dotnetCampus.Nullable)|
23+
|dotnetCampus.Nullable.Source|支援使用豐富的可空支援的源碼版本|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Nullable.Source.svg)](https://www.nuget.org/packages/dotnetCampus.Nullable.Source)|
24+
|dotnetCampus.Required|增加了 required 語法的支援*|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Required.svg)](https://www.nuget.org/packages/dotnet```markdown
25+
Campus.Required)|
26+
|dotnetCampus.Required.Source|增加了 required 語法支援的源碼版本*|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Required.Source.svg)](https://www.nuget.org/packages/dotnetCampus.Required.Source)|
27+
28+
\* 對於 required 語法的介紹,您可以參考這裡的[說明](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/required)【7†source】【9†source】。
29+
30+
## 使用方法
31+
32+
無論是全功能包還是單一功能包,我們都提供了兩種版本。不帶 .Source 後綴的包會生成一個 dll,這樣所有引用了這個項目的項目都能使用到這些新功能。而帶有 .Source 後綴的包則只對安裝此包的項目有效,最終生成的項目中沒有額外的 dll。
33+
34+
如果您希望 .Source 包對其他引用了此項目的項目也生效,可以在 csproj 文件中增加一個條件編譯符:
35+
36+
```xml
37+
<!-- 預設情況下,安裝 .Source 後綴的包會將 C# 新特性以 internal 修飾符引入當前項目。
38+
使用此條件編譯符,可以將這些類型設為 public,使得引用此項目的其他項目也能使用這些新特性。 -->
39+
<DefineConstants>$(DefineConstants);USE_PUBLIC_LATEST_CSHARP_FEATURES</DefineConstants>
40+
```
41+
42+
## 反饋與貢獻
43+
44+
我們歡迎所有用戶的反饋和貢獻。如果你在使用過程中發現任何問題,或者有任何改進建議,都可以通過 GitHub Issues 提交。
45+
46+
如果你希望參與到項目的開發中,也非常歡迎!你可以 Fork 本倉庫,然後提交 Pull Request。
47+
48+
感謝你對 dotnetCampus.LatestCSharpFeatures 的支援和幫助!

0 commit comments

Comments
 (0)