Skip to content

Commit a9afb94

Browse files
committed
新增(csproj): 添加NuGet包元数据及LICENSE支持
添加NuGet包元数据配置,包括PackageOutputPath、PackageIcon、PackageReadmeFile和PackageLicenseFile等属性。 修复tools目录下脚本路径问题,去掉路径前的反斜杠。 修改README.md的引用方式,添加Link属性以确保正确链接。 支持LICENSE.txt和logo.png文件的打包,明确Pack和PackagePath配置。 删除冗余ItemGroup节点,合并相关文件配置。 移除Directory.Build.props中的重复配置,避免冲突。 新增LICENSE.txt文件,采用MIT许可证,明确版权信息。
1 parent 723e894 commit a9afb94

File tree

3 files changed

+37
-9
lines changed

3 files changed

+37
-9
lines changed

src/CodeInject/CodeInject.csproj

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@
66
<DevelopmentDependency>true</DevelopmentDependency>
77
<IncludeSymbols>false</IncludeSymbols>
88
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
9+
<!-- Package metadata -->
10+
<PackageOutputPath>$(SolutionDir)\Build\NugetPackages\Packages</PackageOutputPath>
11+
<PackageIcon>logo.png</PackageIcon>
12+
<PackageReadmeFile>README.md</PackageReadmeFile>
13+
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
914
</PropertyGroup>
1015

1116
<ItemGroup>
1217
<ProjectReference Include="..\CodeInjectSourceGenerator\CodeInjectSourceGenerator.csproj" PrivateAssets="all" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
1318
</ItemGroup>
1419

1520
<ItemGroup>
16-
<None Include="\tools\*.ps1" PackagePath="tools" Pack="true" Visible="false" />
21+
<None Include="tools\*.ps1" PackagePath="tools" Pack="true" Visible="false" />
1722
<None Include="..\CodeInjectSourceGenerator\bin\$(Configuration)\netstandard2.0\CodeInjectSourceGenerator.dll" PackagePath="analyzers\dotnet\cs" Pack="true" Visible="false" />
1823
</ItemGroup>
1924

@@ -23,11 +28,16 @@
2328
</PropertyGroup>
2429

2530
<ItemGroup>
26-
<None Include="logo.png" Pack="true" PackagePath="\" />
27-
</ItemGroup>
28-
29-
<ItemGroup>
30-
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
31+
<None Include="..\..\README.md" Link="README.md" Pack="true" PackagePath="\">
32+
</None>
33+
<None Include="LICENSE.txt">
34+
<Pack>True</Pack>
35+
<PackagePath></PackagePath>
36+
</None>
37+
<None Include="logo.png">
38+
<Pack>True</Pack>
39+
<PackagePath></PackagePath>
40+
</None>
3141
</ItemGroup>
3242

3343
<Target Name="CopyNuGetPackage" AfterTargets="Pack">

src/CodeInject/LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 若汝棋茗
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

src/Directory.Build.props

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
<NoWarn>IDE0290;IDE0090;IDE0305;IDE0028;IDE0300;IDE0130;IDE0057</NoWarn>
1616
<GenerateSatelliteAssemblies>true</GenerateSatelliteAssemblies>
1717
<GenerateSatelliteAssembliesCore>true</GenerateSatelliteAssembliesCore>
18-
<PackageOutputPath>$(SolutionDir)\Build\NugetPackages\Packages</PackageOutputPath>
19-
<LogoFile>logo.png</LogoFile>
20-
<ReadmeFile>Readme.md</ReadmeFile>
2118
<!--<Nullable>enable</Nullable>-->
2219
</PropertyGroup>
2320
</Project>

0 commit comments

Comments
 (0)