Skip to content

Commit

Permalink
加上 dotnetCampus.LatestCsharpFeatures
Browse files Browse the repository at this point in the history
  • Loading branch information
walterlv committed Jun 1, 2023
1 parent 88dfeeb commit 1861128
Show file tree
Hide file tree
Showing 20 changed files with 87 additions and 56 deletions.
2 changes: 1 addition & 1 deletion build/Version.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>1.0.0</Version>
<Version>0.0.0-alpha01</Version>
</PropertyGroup>
</Project>
24 changes: 18 additions & 6 deletions dotnetCampus.LatestCsharpFeatures.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ VisualStudioVersion = 17.6.33712.159
MinimumVisualStudioVersion = 15.0.26124.0
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnetCampus.Nullable", "src\dotnetCampus.Nullable\dotnetCampus.Nullable.csproj", "{2ECF1CEB-070E-4933-93C4-F7FD42D8693C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnetCampus.Nullable.Source", "dotnetCampus.Nullable.Source\dotnetCampus.Nullable.Source.csproj", "{9A7C6595-ED09-42E6-B05F-3F8EEC29BCD5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决方案项", "{8A6F61D3-076F-4B75-80A1-FF377AC69D73}"
ProjectSection(SolutionItems) = preProject
.gitattributes = .gitattributes
Expand All @@ -25,6 +23,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnetCampus.Required", "sr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnetCampus.Required.Source", "src\dotnetCampus.Required.Source\dotnetCampus.Required.Source.csproj", "{4EBF62CB-613E-4496-B890-B1F433ED7581}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnetCampus.LatestCsharpFeatures", "src\dotnetCampus.LatestCsharpFeatures\dotnetCampus.LatestCsharpFeatures.csproj", "{D0B0F7EB-3C81-45C4-BB47-5DCB16F2EA55}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnetCampus.Nullable.Source", "src\dotnetCampus.Nullable.Source\dotnetCampus.Nullable.Source.csproj", "{72163C73-CBC5-4CB5-BDDF-769B7AFD6FAB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnetCampus.LatestCsharpFeatures.Source", "src\dotnetCampus.LatestCsharpFeatures.Source\dotnetCampus.LatestCsharpFeatures.Source.csproj", "{C907433B-19CB-4216-9002-C3C9AC2A8633}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -35,10 +39,6 @@ Global
{2ECF1CEB-070E-4933-93C4-F7FD42D8693C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2ECF1CEB-070E-4933-93C4-F7FD42D8693C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2ECF1CEB-070E-4933-93C4-F7FD42D8693C}.Release|Any CPU.Build.0 = Release|Any CPU
{9A7C6595-ED09-42E6-B05F-3F8EEC29BCD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A7C6595-ED09-42E6-B05F-3F8EEC29BCD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A7C6595-ED09-42E6-B05F-3F8EEC29BCD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A7C6595-ED09-42E6-B05F-3F8EEC29BCD5}.Release|Any CPU.Build.0 = Release|Any CPU
{0DDC38EF-851E-49E7-B72A-DF46E44E3586}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0DDC38EF-851E-49E7-B72A-DF46E44E3586}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0DDC38EF-851E-49E7-B72A-DF46E44E3586}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -55,6 +55,18 @@ Global
{4EBF62CB-613E-4496-B890-B1F433ED7581}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EBF62CB-613E-4496-B890-B1F433ED7581}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EBF62CB-613E-4496-B890-B1F433ED7581}.Release|Any CPU.Build.0 = Release|Any CPU
{D0B0F7EB-3C81-45C4-BB47-5DCB16F2EA55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D0B0F7EB-3C81-45C4-BB47-5DCB16F2EA55}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D0B0F7EB-3C81-45C4-BB47-5DCB16F2EA55}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D0B0F7EB-3C81-45C4-BB47-5DCB16F2EA55}.Release|Any CPU.Build.0 = Release|Any CPU
{72163C73-CBC5-4CB5-BDDF-769B7AFD6FAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72163C73-CBC5-4CB5-BDDF-769B7AFD6FAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72163C73-CBC5-4CB5-BDDF-769B7AFD6FAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72163C73-CBC5-4CB5-BDDF-769B7AFD6FAB}.Release|Any CPU.Build.0 = Release|Any CPU
{C907433B-19CB-4216-9002-C3C9AC2A8633}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C907433B-19CB-4216-9002-C3C9AC2A8633}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C907433B-19CB-4216-9002-C3C9AC2A8633}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C907433B-19CB-4216-9002-C3C9AC2A8633}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 0 additions & 1 deletion src/dotnetCampus.IsExternalInit/_._
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

5 changes: 5 additions & 0 deletions src/dotnetCampus.LatestCsharpFeatures.Source/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace dotnetCampus.LatestCsharpFeatures.Source;
public class Class1
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net5.0;netcoreapp3.0;netstandard1.0;net40</TargetFrameworks>
<RootNamespace>System.Diagnostics.CodeAnalysis</RootNamespace>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageId>dotnetCampus.LatestCsharpFeatures</PackageId>
<Description>This comprehensive package provides support for the latest C# language features in your project, enabling older .NET projects to use newer C# language constructs. Currently includes support for 'nullable', 'init', and 'required' keywords. The types introduced are internal, confining these features to the project itself without affecting other projects that reference it. By installing this package, you get all the newest C# features in one place, eliminating the need to install separate packages for each feature. Future updates will include more new features as they are released.</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="dotnetCampus.SourceYard" Version="1.0.0-alpha01" PrivateAssets="all" />
</ItemGroup>

</Project>
9 changes: 0 additions & 9 deletions src/dotnetCampus.LatestCsharpFeatures/Class1.cs

This file was deleted.

Empty file.
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0;net45</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<!-- 在 GitHub 的 Action 构建会添加 GITHUB_ACTIONS 变量 -->
<!-- 下面进行自动构建,自动添加源代码链接等 -->
<!-- 详细请看 https://github.com/dotnet/sourcelink -->
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>

<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>

<!-- 只有在 GitHub 的 Action 构建才能使用源代码链接 -->
<!-- 源代码链接需要使用 commit 号,而在 GitHub 的 Action 构建的 commit 才是对的 -->
<!-- 本地构建,也许没有记得 commit 就构建,此时的 nuget 包的源代码是不对的,上传上去会让调试诡异 -->
<!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>

<!-- 本地等不需要创建符号文件 -->
<!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<!-- 链接源代码到 GitHub 仓库,方便调试 -->
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net5.0;netcoreapp3.0;netstandard1.0;net40</TargetFrameworks>
<RootNamespace>System.Diagnostics.CodeAnalysis</RootNamespace>
<Description>This comprehensive package provides support for the latest C# language features in your project, enabling older .NET projects to use newer C# language constructs. Currently includes support for 'nullable', 'init', and 'required' keywords. The types introduced are public, allowing these features to propagate to other projects that reference this one. By installing this package, you get all the newest C# features in one place, eliminating the need to install separate packages for each feature. Future updates will include more new features as they are released.</Description>
<BuildOutputTargetFolder>Miscellaneous</BuildOutputTargetFolder>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\dotnetCampus.Nullable\**\*.cs" Exclude="..\dotnetCampus.Nullable\**\obj\**\*.cs;..\dotnetCampus.Nullable\**\bin\**\*.cs" />
<Compile Include="..\dotnetCampus.IsExternalInit\**\*.cs" Exclude="..\dotnetCampus.IsExternalInit\**\obj\**\*.cs;..\dotnetCampus.IsExternalInit\**\bin\**\*.cs" />
<Compile Include="..\dotnetCampus.Required\**\*.cs" Exclude="..\dotnetCampus.Required\**\obj\**\*.cs;..\dotnetCampus.Required\**\bin\**\*.cs" />
</ItemGroup>

<Target Name="IncludeAllDependencies" BeforeTargets="_GetPackageFiles">
<ItemGroup>
<None Include="_._" Pack="True" PackagePath="lib\net7.0" />
<None Include="$(OutputPath)\net5.0\$(PackageId).dll" Pack="True" PackagePath="lib\net5.0" />
<None Include="$(OutputPath)\net5.0\$(PackageId).pdb" Pack="True" PackagePath="lib\net5.0" />
<None Include="$(OutputPath)\net5.0\$(PackageId).xml" Pack="True" PackagePath="lib\net5.0" />
<None Include="$(OutputPath)\netcoreapp3.0\$(PackageId).dll" Pack="True" PackagePath="lib\netcoreapp3.0" />
<None Include="$(OutputPath)\netcoreapp3.0\$(PackageId).pdb" Pack="True" PackagePath="lib\netcoreapp3.0" />
<None Include="$(OutputPath)\netcoreapp3.0\$(PackageId).xml" Pack="True" PackagePath="lib\netcoreapp3.0" />
<None Include="$(OutputPath)\netstandard1.0\$(PackageId).dll" Pack="True" PackagePath="lib\netstandard1.0" />
<None Include="$(OutputPath)\netstandard1.0\$(PackageId).pdb" Pack="True" PackagePath="lib\netstandard1.0" />
<None Include="$(OutputPath)\netstandard1.0\$(PackageId).xml" Pack="True" PackagePath="lib\netstandard1.0" />
<None Include="$(OutputPath)\net40\$(PackageId).dll" Pack="True" PackagePath="lib\net40" />
<None Include="$(OutputPath)\net40\$(PackageId).pdb" Pack="True" PackagePath="lib\net40" />
<None Include="$(OutputPath)\net40\$(PackageId).xml" Pack="True" PackagePath="lib\net40" />
</ItemGroup>
</Target>

</Project>
File renamed without changes.
1 change: 0 additions & 1 deletion src/dotnetCampus.Nullable/_._
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
namespace System.Runtime.CompilerServices
#if NET7_0_OR_GREATER
// .NET 7.0 开始已包含 required。
#else
// 旧框架需要包含 required。
namespace System.Runtime.CompilerServices
{
/// <summary>
/// Specifies that a type has required members or that a member is required.
Expand Down Expand Up @@ -41,3 +45,4 @@ public CompilerFeatureRequiredAttribute(string featureName)
public const string RequiredMembers = nameof(RequiredMembers);
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
namespace System.Runtime.CompilerServices
#if NET7_0_OR_GREATER
// .NET 7.0 开始已包含 required。
#else
// 旧框架需要包含 required。
namespace System.Runtime.CompilerServices
{
/// <summary>
/// Specifies that a type has required members or that a member is required.
Expand Down Expand Up @@ -41,3 +45,4 @@ public CompilerFeatureRequiredAttribute(string featureName)
public const string RequiredMembers = nameof(RequiredMembers);
}
}
#endif
1 change: 0 additions & 1 deletion src/dotnetCampus.Required/_._
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

7 changes: 5 additions & 2 deletions src/dotnetCampus.Required/dotnetCampus.Required.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;netcoreapp3.0;netstandard1.0;net40</TargetFrameworks>
<TargetFrameworks>net7.0;net5.0;netcoreapp3.0;netstandard1.0;net40</TargetFrameworks>
<RootNamespace>System.Diagnostics.CodeAnalysis</RootNamespace>
<Description>If you use C# 9.0 or later and want to use record types, this library adds public IsExternalInit attribute support for your project, allowing the new language feature to be propagated to other projects that reference this one.</Description>
<BuildOutputTargetFolder>Miscellaneous</BuildOutputTargetFolder>
Expand All @@ -10,6 +10,9 @@
<Target Name="IncludeAllDependencies" BeforeTargets="_GetPackageFiles">
<ItemGroup>
<None Include="_._" Pack="True" PackagePath="lib\net7.0" />
<None Include="$(OutputPath)\net5.0\$(PackageId).dll" Pack="True" PackagePath="lib\net5.0" />
<None Include="$(OutputPath)\net5.0\$(PackageId).pdb" Pack="True" PackagePath="lib\net5.0" />
<None Include="$(OutputPath)\net5.0\$(PackageId).xml" Pack="True" PackagePath="lib\net5.0" />
<None Include="$(OutputPath)\netcoreapp3.0\$(PackageId).dll" Pack="True" PackagePath="lib\netcoreapp3.0" />
<None Include="$(OutputPath)\netcoreapp3.0\$(PackageId).pdb" Pack="True" PackagePath="lib\netcoreapp3.0" />
<None Include="$(OutputPath)\netcoreapp3.0\$(PackageId).xml" Pack="True" PackagePath="lib\netcoreapp3.0" />
Expand All @@ -22,7 +25,7 @@
</ItemGroup>
</Target>

<ItemGroup Condition="'$(TargetFramework)'!='net7.0'">
<ItemGroup Condition="'$(TargetFramework)'!='net7.0' AND '$(TargetFramework)'!='net5.0'">
<ProjectReference Include="..\dotnetCampus.IsExternalInit\dotnetCampus.IsExternalInit.csproj" />
</ItemGroup>

Expand Down

0 comments on commit 1861128

Please sign in to comment.