build: add shared project metadata
This commit is contained in:
1 parent
b15e57d150
commit
c91cf1b826
2 files changed
+134
No files matched your search
@@ -0,0 +1,49 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<!-- 项目基本信息 -->
|
||||
<Authors>duyl328</Authors>
|
||||
<Company>duyl328</Company>
|
||||
<Product>Sharp-Basic Framework</Product>
|
||||
<Description>模块化.NET 8企业应用开发框架</Description>
|
||||
<Copyright>Copyright © 2024-2025 duyl328. All rights reserved.</Copyright>
|
||||
|
||||
<!-- 版本信息 -->
|
||||
<VersionPrefix>1.0.1</VersionPrefix>
|
||||
<AssemblyVersion>1.0.1.0</AssemblyVersion>
|
||||
<FileVersion>1.0.1.0</FileVersion>
|
||||
|
||||
<!-- 仓库信息 -->
|
||||
<RepositoryUrl>https://gitea.duyl328.org/jimmy/sharp-basic</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PackageProjectUrl>https://gitea.duyl328.org/jimmy/sharp-basic</PackageProjectUrl>
|
||||
|
||||
<!-- 许可证信息 -->
|
||||
<PackageLicenseExpression>AGPL-3.0-or-later</PackageLicenseExpression>
|
||||
|
||||
<!-- 编译设置 -->
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
|
||||
<!-- 包设置 -->
|
||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||
<PackageTags>wpf;mvvm;dotnet;framework;plc;industrial;iot;siemens;ef-core;serilog;configuration;csharp;enterprise;modular;iiot</PackageTags>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
|
||||
<!-- 源代码链接 (用于调试) -->
|
||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||
|
||||
<!-- 确定性构建 -->
|
||||
<Deterministic>true</Deterministic>
|
||||
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true' or '$(CI)' == 'true'">true</ContinuousIntegrationBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- NuGet 包引用:源链接支持 -->
|
||||
<ItemGroup Condition="'$(SourceRoot)' != ''">
|
||||
<PackageReference Include="Microsoft.SourceLink.Gitea" Version="8.0.0" PrivateAssets="All"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,85 @@
|
||||
# Clean redundant metadata from all project files
|
||||
# Projects will inherit from Directory.Build.props
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Write-Host "Cleaning Project Metadata..." -ForegroundColor Cyan
|
||||
|
||||
# Get all .csproj files
|
||||
$projectFiles = Get-ChildItem -Path "." -Filter "*.csproj" -Recurse |
|
||||
Where-Object { $_.FullName -notmatch "\\obj\\" -and $_.FullName -notmatch "\\bin\\" }
|
||||
|
||||
Write-Host "Found $($projectFiles.Count) project files" -ForegroundColor Yellow
|
||||
|
||||
# Metadata properties to remove (will inherit from Directory.Build.props)
|
||||
$metadataToRemove = @(
|
||||
"Version",
|
||||
"AssemblyVersion",
|
||||
"FileVersion",
|
||||
"Authors",
|
||||
"Company",
|
||||
"Product",
|
||||
"Copyright",
|
||||
"PackageId",
|
||||
"PackageProjectUrl",
|
||||
"RepositoryUrl",
|
||||
"RepositoryType",
|
||||
"PackageLicenseExpression"
|
||||
)
|
||||
|
||||
$totalModified = 0
|
||||
|
||||
foreach ($projectFile in $projectFiles) {
|
||||
Write-Host "`nProcessing: $($projectFile.Name)" -ForegroundColor Cyan
|
||||
|
||||
# Read file content
|
||||
$lines = Get-Content -Path $projectFile.FullName -Encoding UTF8
|
||||
$newLines = New-Object System.Collections.ArrayList
|
||||
$modified = $false
|
||||
$removedCount = 0
|
||||
|
||||
# Filter out metadata lines
|
||||
foreach ($line in $lines) {
|
||||
$shouldSkip = $false
|
||||
|
||||
# Check if line contains any metadata to remove
|
||||
foreach ($metadata in $metadataToRemove) {
|
||||
if ($line -match "<$metadata>.*</$metadata>") {
|
||||
$shouldSkip = $true
|
||||
$removedCount++
|
||||
Write-Host " Removed: $metadata" -ForegroundColor Gray
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
# Skip comment lines
|
||||
if ($line -match "<!--\s*(程序集元数据|NuGet 包元数据)\s*-->") {
|
||||
$shouldSkip = $true
|
||||
}
|
||||
|
||||
if (-not $shouldSkip) {
|
||||
[void]$newLines.Add($line)
|
||||
} else {
|
||||
$modified = $true
|
||||
}
|
||||
}
|
||||
|
||||
# Save if modified
|
||||
if ($modified) {
|
||||
$newLines | Set-Content -Path $projectFile.FullName -Encoding UTF8
|
||||
Write-Host " Updated ($removedCount properties removed)" -ForegroundColor Green
|
||||
$totalModified++
|
||||
} else {
|
||||
Write-Host " No changes needed" -ForegroundColor DarkGray
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "`n========================================" -ForegroundColor Cyan
|
||||
Write-Host "Done! Updated $totalModified project files" -ForegroundColor Green
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host "`nProjects now inherit from Directory.Build.props:" -ForegroundColor Yellow
|
||||
Write-Host " - Version, Authors, Copyright" -ForegroundColor White
|
||||
Write-Host " - Repository URLs, License" -ForegroundColor White
|
||||
Write-Host "`nProject-specific properties retained:" -ForegroundColor Yellow
|
||||
Write-Host " - Description" -ForegroundColor White
|
||||
Write-Host " - PackageTags" -ForegroundColor White
|
||||
Reference in new issue
Block a user