Skip to content

Commit a3a1f08

Browse files
committed
重构(project): 调整项目结构并增强功能
删除使用示例文档,新增模板项目 CodeRegionTemplateConsoleApp,分离示例项目 CodeRegionExamplesConsoleApp。 CodeInject 项目支持多目标框架,新增签名配置和 NuGet 包生成支持,提升诊断信息定位能力。 更新版本号至 0.0.5,扩展代码生成示例,优化开发者体验。
1 parent e3d31b6 commit a3a1f08

File tree

12 files changed

+88
-191
lines changed

12 files changed

+88
-191
lines changed

USAGE_EXAMPLE.md

Lines changed: 0 additions & 167 deletions
This file was deleted.

examples/CodeRegionExamples.slnx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<Solution>
2+
<Project Path="CodeRegionExamplesConsoleApp/CodeRegionExamplesConsoleApp.csproj" />
3+
<Project Path="CodeRegionTemplateConsoleApp/CodeRegionTemplateConsoleApp.csproj" Id="e70f3b90-7ae6-445b-b211-e2fb1fcf0a87" />
4+
</Solution>

examples/CodeRegionExamples/CodeRegionExamples.slnx

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/CodeRegionExamples/CodeRegionExamplesConsoleApp/CodeRegionExamplesConsoleApp.csproj renamed to examples/CodeRegionExamplesConsoleApp/CodeRegionExamplesConsoleApp.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="CodeInject" Version="0.0.1">
11+
<PackageReference Include="CodeInject" Version="0.0.5">
1212
<PrivateAssets>all</PrivateAssets>
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
</PackageReference>
1515
</ItemGroup>
1616

17+
<ItemGroup>
18+
<AdditionalFiles Include="../CodeRegionTemplateConsoleApp/Program.cs" />
19+
</ItemGroup>
1720
</Project>

examples/CodeRegionExamples/CodeRegionExamplesConsoleApp/Program.cs renamed to examples/CodeRegionExamplesConsoleApp/Program.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ------------------------------------------------------------------------------
1+
// ------------------------------------------------------------------------------
22
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
33
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
44
// CSDN博客:https://blog.csdn.net/qq_40374647
@@ -10,12 +10,15 @@
1010
// 感谢您的下载和使用
1111
// ------------------------------------------------------------------------------
1212

13+
using CodeRegionSourceGenerator;
14+
1315
namespace CodeRegionExamplesConsoleApp;
1416

15-
internal class Program
17+
[RegionInject("./CodeRegionTemplateConsoleApp/Program.cs", "Show")]
18+
internal partial class ExampleProgram
1619
{
1720
static void Main(string[] args)
1821
{
19-
Console.WriteLine("Hello, World!");
22+
Show();
2023
}
2124
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net9.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
</Project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// ------------------------------------------------------------------------------
2+
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
3+
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
4+
// CSDN博客:https://blog.csdn.net/qq_40374647
5+
// 哔哩哔哩视频:https://space.bilibili.com/94253567
6+
// Gitee源代码仓库:https://gitee.com/RRQM_Home
7+
// Github源代码仓库:https://github.com/RRQM
8+
// API首页:https://touchsocket.net/
9+
// 交流QQ群:234762506
10+
// 感谢您的下载和使用
11+
// ------------------------------------------------------------------------------
12+
13+
namespace CodeRegionTemplateConsoleApp;
14+
15+
internal class TemplateProgram
16+
{
17+
static void Main(string[] args)
18+
{
19+
Console.WriteLine("Hello, World!");
20+
}
21+
22+
#region Show
23+
public static void Show()
24+
{
25+
Console.WriteLine("Show");
26+
}
27+
#endregion
28+
29+
}

src/CodeInject/CodeInject.csproj

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,38 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
55
<!-- Development Dependencies Only -->
66
<DevelopmentDependency>true</DevelopmentDependency>
77
<IncludeSymbols>false</IncludeSymbols>
8+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
89
</PropertyGroup>
910

1011
<ItemGroup>
11-
<ProjectReference Include="..\CodeInjectSourceGenerator\CodeInjectSourceGenerator.csproj" PrivateAssets="all" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
12+
<ProjectReference Include="..\CodeInjectSourceGenerator\CodeInjectSourceGenerator.csproj" PrivateAssets="all" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
1213
</ItemGroup>
1314

1415
<ItemGroup>
1516
<None Include="\tools\*.ps1" PackagePath="tools" Pack="true" Visible="false" />
1617
<None Include="..\CodeInjectSourceGenerator\bin\$(Configuration)\netstandard2.0\CodeInjectSourceGenerator.dll" PackagePath="analyzers\dotnet\cs" Pack="true" Visible="false" />
1718
</ItemGroup>
1819

20+
<PropertyGroup Condition="'$(Configuration)'=='Release'">
21+
<AssemblyOriginatorKeyFile>$(MSBuildProjectName).snk</AssemblyOriginatorKeyFile>
22+
<SignAssembly>True</SignAssembly>
23+
</PropertyGroup>
24+
25+
<ItemGroup>
26+
<None Include="logo.png" Pack="true" PackagePath="\" />
27+
</ItemGroup>
28+
29+
<ItemGroup>
30+
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
31+
</ItemGroup>
32+
33+
<Target Name="CopyNuGetPackage" AfterTargets="Pack">
34+
<Copy SourceFiles="$(PackageOutputPath)\$(PackageId).$(PackageVersion).nupkg"
35+
DestinationFolder="D:\Nuget\local"
36+
Condition="Exists('D:\Nuget\local')" />
37+
</Target>
1938
</Project>

src/CodeInject/CodeInject.snk

596 Bytes
Binary file not shown.

src/CodeInject/logo.png

5.97 KB
Loading

0 commit comments

Comments
 (0)