build: 📦 整理构建相关的工程文件 (#64)

This commit is contained in:
nsnail 2023-11-22 16:02:07 +08:00 committed by GitHub
parent b4b4f23968
commit 20195e7eaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 95 additions and 134 deletions

1
.gitignore vendored
View File

@ -400,7 +400,6 @@ FodyWeavers.xsd
# User Define # User Define
dist/ dist/
refs/
*.[Dd]esigner.cs *.[Dd]esigner.cs
*.db *.db
cache cache

9
.gitmodules vendored Normal file
View File

@ -0,0 +1,9 @@
[submodule "refs/Furion"]
path = refs/Furion
url = https://github.com/nsnail/Furion.git
[submodule "refs/ns-ext"]
path = refs/ns-ext
url = https://github.com/nsnail/ns-ext.git
[submodule "refs/FreeSql"]
path = refs/FreeSql
url = https://github.com/nsnail/FreeSql.git

View File

@ -1,4 +0,0 @@
[hook "startcommit"]
cmdline = dot.clean.cmd
wait = true
show = true

View File

@ -1,10 +1,10 @@
# Changelog # Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## 1.0.0 (2023-11-17) ## 1.0.0 (2023-11-17)
### Features ### Features
* ✨ 基础模块 ([d26e4c7](https://github.com/nsnail/NetAdmin/commit/d26e4c77cc7264829a410f8503e855531f6b9c19)) * ✨ 基础模块 ([d26e4c7](https://github.com/nsnail/NetAdmin/commit/d26e4c77cc7264829a410f8503e855531f6b9c19))

View File

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<SolutionDir>$(MSBuildThisFileDirectory)</SolutionDir> <SolutionDir>$(MSBuildThisFileDirectory)</SolutionDir>
</PropertyGroup> </PropertyGroup>
<Import Project="$(SolutionDir)/minver.targets"/> <Import Project="$(SolutionDir)/minver.targets" />
<PropertyGroup> <PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Authors>nsnail</Authors> <Authors>nsnail</Authors>
@ -31,6 +31,6 @@
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="../GlobalUsings.cs" Link="GlobalUsings.cs"/> <Compile Include="../GlobalUsings.cs" Link="GlobalUsings.cs" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -13,28 +13,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "meta", "meta", "{5198A03D-0
.editorconfig = .editorconfig .editorconfig = .editorconfig
.gitattributes = .gitattributes .gitattributes = .gitattributes
.gitignore = .gitignore .gitignore = .gitignore
.tgitconfig = .tgitconfig .gitmodules = .gitmodules
1.git.pr.ps1 = 1.git.pr.ps1
build.cake = build.cake
CHANGELOG.md = CHANGELOG.md CHANGELOG.md = CHANGELOG.md
clone.project.refs.ps1 = clone.project.refs.ps1
code.clean.csx = code.clean.csx
code.clean.ps1 = code.clean.ps1
code.cleanup.full.ps1 = code.cleanup.full.ps1
code.quality.props = code.quality.props code.quality.props = code.quality.props
copy.pkg.xml.comment.files.targets = copy.pkg.xml.comment.files.targets copy.pkg.xml.comment.files.targets = copy.pkg.xml.comment.files.targets
Directory.Build.props = Directory.Build.props Directory.Build.props = Directory.Build.props
Dockerfile = Dockerfile Dockerfile = Dockerfile
dot.clean.cmd = dot.clean.cmd
dotnet-tools.json = dotnet-tools.json dotnet-tools.json = dotnet-tools.json
gen.cs.tt = gen.cs.tt
gen.id.linq = gen.id.linq
gen.ln.cmd = gen.ln.cmd
gen.resx.tt = gen.resx.tt
git.rc.ps1 = git.rc.ps1
global.json = global.json global.json = global.json
image.optimize.csx = image.optimize.csx
install.as.tpl.ps1 = install.as.tpl.ps1
LICENSE = LICENSE LICENSE = LICENSE
minver.targets = minver.targets minver.targets = minver.targets
NetAdmin.sln.DotSettings = NetAdmin.sln.DotSettings NetAdmin.sln.DotSettings = NetAdmin.sln.DotSettings
@ -42,14 +28,37 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "meta", "meta", "{5198A03D-0
package.json = package.json package.json = package.json
prebuild.targets = prebuild.targets prebuild.targets = prebuild.targets
README.md = README.md README.md = README.md
rename.csx = rename.csx
stylecop.analyzers.ruleset = stylecop.analyzers.ruleset stylecop.analyzers.ruleset = stylecop.analyzers.ruleset
StyleCop.json = StyleCop.json StyleCop.json = StyleCop.json
switcher.freesql.json = switcher.freesql.json EndProjectSection
switcher.furion.json = switcher.furion.json EndProject
switcher.nsext.json = switcher.nsext.json Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{BB0B25C9-0901-4923-913F-00F9A6B352A5}"
switcher.ps1 = switcher.ps1 ProjectSection(SolutionItems) = preProject
sync.sln.files.csx = sync.sln.files.csx code.clean.csx = scripts/code.clean.csx
code.clean.ps1 = scripts/code.clean.ps1
code.cleanup.full.ps1 = scripts/code.cleanup.full.ps1
dot.clean.cmd = scripts/dot.clean.cmd
gen.cs.tt = scripts/gen.cs.tt
gen.id.linq = scripts/gen.id.linq
gen.ln.cmd = scripts/gen.ln.cmd
gen.resx.tt = scripts/gen.resx.tt
git.pr.ps1 = scripts/git.pr.ps1
git.rc.ps1 = scripts/git.rc.ps1
image.optimize.csx = scripts/image.optimize.csx
install.as.tpl.ps1 = scripts/install.as.tpl.ps1
rename.csx = scripts/rename.csx
switcher.freesql.json = scripts/switcher.freesql.json
switcher.furion.json = scripts/switcher.furion.json
switcher.nsext.json = scripts/switcher.nsext.json
switcher.ps1 = scripts/switcher.ps1
sync.sln.files.csx = scripts/sync.sln.files.csx
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{1129FE25-466B-4F4F-85FC-3752664245E1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{3C6F049E-3EE8-4D66-9AFF-E8A369032487}"
ProjectSection(SolutionItems) = preProject
ci.yml = .github/workflows/ci.yml
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetAdmin.Infrastructure", "src\backend\NetAdmin.Infrastructure\NetAdmin.Infrastructure.csproj", "{1E62C322-EE42-4699-A6F1-791C53EFA62D}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetAdmin.Infrastructure", "src\backend\NetAdmin.Infrastructure\NetAdmin.Infrastructure.csproj", "{1E62C322-EE42-4699-A6F1-791C53EFA62D}"
@ -88,13 +97,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "06.Tests", "06.Tests", "{89
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetAdmin.BizServer.Tests", "src\backend\NetAdmin.BizServer.Tests\NetAdmin.BizServer.Tests.csproj", "{C7F27698-DA05-4ACD-B0D7-4791B3972002}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetAdmin.BizServer.Tests", "src\backend\NetAdmin.BizServer.Tests\NetAdmin.BizServer.Tests.csproj", "{C7F27698-DA05-4ACD-B0D7-4791B3972002}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{1129FE25-466B-4F4F-85FC-3752664245E1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{3C6F049E-3EE8-4D66-9AFF-E8A369032487}"
ProjectSection(SolutionItems) = preProject
ci.yml = .github/workflows/ci.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetAdmin.Tests", "src\backend\NetAdmin.Tests\NetAdmin.Tests.csproj", "{00604162-C444-478B-B773-3AB23C856CA7}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetAdmin.Tests", "src\backend\NetAdmin.Tests\NetAdmin.Tests.csproj", "{00604162-C444-478B-B773-3AB23C856CA7}"
EndProject EndProject
Global Global

View File

@ -2,7 +2,6 @@
通用后台权限管理系统、快速开发框架基于C#12/.NET8、Vue3/Vite、Element Plus等现代技术构建具有十分整洁、优雅的编码规范 通用后台权限管理系统、快速开发框架基于C#12/.NET8、Vue3/Vite、Element Plus等现代技术构建具有十分整洁、优雅的编码规范
[![.NET](https://github.com/nsnail/NetAdmin/actions/workflows/ci.yml/badge.svg)](https://github.com/nsnail/NetAdmin/actions/workflows/ci.yml) [![.NET](https://github.com/nsnail/NetAdmin/actions/workflows/ci.yml/badge.svg)](https://github.com/nsnail/NetAdmin/actions/workflows/ci.yml)
[![MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nsnail/NetAdmin/blob/main/LICENSE) [![MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nsnail/NetAdmin/blob/main/LICENSE)
[![Furion](https://img.shields.io/badge/Furion-4.x-blueviolet.svg)](https://github.com/nsnail/NetAdmin/blob/main/LICENSE) [![Furion](https://img.shields.io/badge/Furion-4.x-blueviolet.svg)](https://github.com/nsnail/NetAdmin/blob/main/LICENSE)

View File

@ -1,49 +0,0 @@
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var outputDirectory = Argument("output-directory", "./dist/backend/publish");
////////////////////////////////////////////////////////////////
// Tasks
Task("Clean")
.Does(context =>
{
context.CleanDirectory("./dist");
});
Task("Build")
.IsDependentOn("Clean")
.Does(context =>
{
DotNetBuild("./NetAdmin.sln", new DotNetBuildSettings {
Configuration = configuration
});
});
Task("Publish-BizServer")
.Does(context =>
{
DotNetPublish("./src/backend/NetAdmin.BizServer.Host/NetAdmin.BizServer.Host.csproj", new DotNetPublishSettings {
NoBuild = true,
Configuration = configuration,
OutputDirectory = new DirectoryPath(outputDirectory)
});
});
Task("Publish-ScheduledService")
.Does(context =>
{
DotNetPublish("./src/backend/NetAdmin.ScheduledService/NetAdmin.ScheduledService.csproj", new DotNetPublishSettings {
NoBuild = true,
Configuration = configuration,
OutputDirectory = new DirectoryPath(outputDirectory)
});
});
Task("Default")
.IsDependentOn("Build");
////////////////////////////////////////////////////////////////
// Execution
RunTarget(target)

View File

@ -1,6 +0,0 @@
$refs = ('https://github.com/nsnail/ns-ext.git', 'https://github.com/nsnail/Furion.git', 'https://github.com/nsnail/FreeSql.git')
foreach ($item in $refs)
{
git clone --depth 1 --config "http.proxy=http://127.0.0.1:1081" $item "./refs/$( [regex]::Match($item, '/([^/]+)\.git$').Groups[1] )"
}

View File

@ -1 +0,0 @@
dotnet jb cleanupcode --no-build ./NetAdmin.sln

View File

@ -3,8 +3,8 @@
<ItemGroup> <ItemGroup>
<PackageReferenceFiles <PackageReferenceFiles
Condition="%(PackageReference.CopyToOutputDirectory) != ''" Condition="%(PackageReference.CopyToOutputDirectory) != ''"
Include="$(NugetPackageRoot)\%(PackageReference.Identity)\%(PackageReference.Version)\%(PackageReference.CopyToOutputDirectory)"/> Include="$(NugetPackageRoot)\%(PackageReference.Identity)\%(PackageReference.Version)\%(PackageReference.CopyToOutputDirectory)" />
</ItemGroup> </ItemGroup>
<Copy SourceFiles="@(PackageReferenceFiles)" DestinationFolder="$(OutDir)"/> <Copy SourceFiles="@(PackageReferenceFiles)" DestinationFolder="$(OutDir)" />
</Target> </Target>
</Project> </Project>

View File

@ -1,4 +0,0 @@
call npm --prefix ./src/frontend/admin run prettier
dot rbom -w -e refs -e .git -e node_modules
dot trim -w -e refs -e .git -e node_modules
dot tolf -w -e refs -e .git -e node_modules

View File

@ -8,12 +8,6 @@
"t4" "t4"
] ]
}, },
"cake.tool": {
"version": "4.0.0",
"commands": [
"dotnet-cake"
]
},
"dotnet-script": { "dotnet-script": {
"version": "1.5.0", "version": "1.5.0",
"commands": [ "commands": [
@ -21,7 +15,7 @@
] ]
}, },
"jetbrains.resharper.globaltools": { "jetbrains.resharper.globaltools": {
"version": "2023.2.3", "version": "2023.3.0-eap08",
"commands": [ "commands": [
"jb" "jb"
] ]

View File

@ -1,2 +0,0 @@
dotnet t4 ./gen.resx.tt -o ./assets/res/Ln.resx
dotnet t4 ./gen.cs.tt -o ./dist/backend/NetAdmin.Infrastructure/Ln.cs

View File

@ -1,2 +0,0 @@
dotnet new uninstall .
dotnet new --install .

View File

@ -2,7 +2,7 @@
<configuration> <configuration>
<packageSources> <packageSources>
<clear/> <clear />
<add key="nuget.cdn.azure.cn" value="https://nuget.cdn.azure.cn/v3/index.json"/> <add key="nuget.cdn.azure.cn" value="https://nuget.cdn.azure.cn/v3/index.json" />
</packageSources> </packageSources>
</configuration> </configuration>

View File

@ -1,12 +1,12 @@
<Project> <Project>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent"> <Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="dotnet tool restore" StdOutEncoding="utf-8"/> <Exec Command="dotnet tool restore" StdOutEncoding="utf-8"/>
<Exec Condition="!Exists('$(SolutionDir)/assets/res/Ln.resx')" WorkingDirectory="$(SolutionDir)" <Exec Condition="!Exists('$(SolutionDir)/assets/res/Ln.resx')" WorkingDirectory="$(SolutionDir)/scripts"
Command="dotnet t4 $(SolutionDir)/gen.resx.tt -o $(SolutionDir)/assets/res/Ln.resx" Command="dotnet t4 ./gen.resx.tt -o ../assets/res/Ln.resx"
StdOutEncoding="utf-8"/> StdOutEncoding="utf-8"/>
<Exec Condition="!Exists('$(SolutionDir)/dist/backend/$(ProjectName)/Ln.cs')" <Exec Condition="!Exists('$(SolutionDir)/dist/backend/$(ProjectName)/Ln.cs')"
WorkingDirectory="$(SolutionDir)" WorkingDirectory="$(SolutionDir)/scripts"
Command="dotnet t4 $(SolutionDir)/gen.cs.tt -o $(SolutionDir)/dist/backend/$(ProjectName)/Ln.cs" Command="dotnet t4 ./gen.cs.tt -o ../dist/backend/$(ProjectName)/Ln.cs"
StdOutEncoding="utf-8"/> StdOutEncoding="utf-8"/>
</Target> </Target>
<ItemGroup> <ItemGroup>

1
refs/FreeSql Submodule

@ -0,0 +1 @@
Subproject commit 0f6c2b807db92d2ade000558faf3ad5fd9baa34c

1
refs/Furion Submodule

@ -0,0 +1 @@
Subproject commit d23c7cca552e9b1b1365349741139a012e2bc955

1
refs/ns-ext Submodule

@ -0,0 +1 @@
Subproject commit 8c0dbcf1f4507af29517dccebff5289c42e9b477

View File

@ -18,7 +18,7 @@ using System.Net.Http.Json;
{ {
CreateNoWindow = true, CreateNoWindow = true,
FileName = "dotnet", FileName = "dotnet",
Arguments = $"jb cleanupcode --include=\"{files}\" --no-build ./NetAdmin.sln", Arguments = $"jb cleanupcode --include=\"{files}\" --no-build ../NetAdmin.sln",
UseShellExecute = false, UseShellExecute = false,
RedirectStandardOutput = true RedirectStandardOutput = true
} }

View File

@ -0,0 +1 @@
dotnet jb cleanupcode --no-build ../NetAdmin.sln

4
scripts/dot.clean.cmd Normal file
View File

@ -0,0 +1,4 @@
call npm --prefix ../src/frontend/admin run prettier
dot rbom -w -e refs -e .git -e node_modules ../
dot trim -w -e refs -e .git -e node_modules ../
dot tolf -w -e refs -e .git -e node_modules ../

View File

@ -63,7 +63,7 @@ public sealed class Ln
public static CultureInfo Culture { get; set; } public static CultureInfo Culture { get; set; }
<# <#
var xml = new XmlDocument(); var xml = new XmlDocument();
xml.Load("./assets/res/Ln.resx"); xml.Load("../assets/res/Ln.resx");
foreach (XmlNode data in xml.SelectNodes("//root/data")!) foreach (XmlNode data in xml.SelectNodes("//root/data")!)
{ {
#> #>

2
scripts/gen.ln.cmd Normal file
View File

@ -0,0 +1,2 @@
dotnet t4 ./gen.resx.tt -o ../assets/res/Ln.resx
dotnet t4 ./gen.cs.tt -o ../dist/backend/NetAdmin.Infrastructure/Ln.cs

View File

@ -29,7 +29,7 @@
// ReSharper disable DuplicateResource // ReSharper disable DuplicateResource
<# <#
var regex = new Regex(@"^\d", RegexOptions.Compiled); var regex = new Regex(@"^\d", RegexOptions.Compiled);
foreach (var line in File.ReadLines("./assets/res/ln.txt")) foreach (var line in File.ReadLines("../assets/res/ln.txt"))
{ {
#> #>
<data name="<#= regex.IsMatch(line) ? "_" : "" #><#= line #>" xml:space="preserve"><value><#= line #></value></data> <data name="<#= regex.IsMatch(line) ? "_" : "" #><#= line #>" xml:space="preserve"><value><#= line #></value></data>

View File

@ -1,7 +1,7 @@
$branch = $( git branch --show-current ) $branch = $( git branch --show-current )
./dot.clean.cmd ./dot.clean.cmd
git add . git add ../
./node_modules/.bin/git-cz.ps1 ../node_modules/.bin/git-cz.ps1
git pull git pull
git push --set-upstream origin $branch git push --set-upstream origin $branch
Start-Process -FilePath "https://github.com/nsnail/NetAdmin/compare/main...$branch" Start-Process -FilePath "https://github.com/nsnail/NetAdmin/compare/main...$branch"

View File

@ -7,7 +7,7 @@
var files = Directory var files = Directory
.EnumerateFiles( .EnumerateFiles(
"./", "../",
"*.png", "*.png",
new EnumerationOptions new EnumerationOptions
{ {
@ -37,7 +37,7 @@ files = new[] { "*.jpg", "*.jpeg" }
.SelectMany( .SelectMany(
x => x =>
Directory.EnumerateFiles( Directory.EnumerateFiles(
"./", "../",
x, x,
new EnumerationOptions new EnumerationOptions
{ {

View File

@ -0,0 +1,2 @@
dotnet new uninstall ../
dotnet new --install ../

View File

@ -5,7 +5,7 @@ Console.WriteLine("请输入原始名称NetAdmin");
var oldName = Console.ReadLine().NullOrEmpty("NetAdmin"); var oldName = Console.ReadLine().NullOrEmpty("NetAdmin");
Console.WriteLine("请输入替换名称:"); Console.WriteLine("请输入替换名称:");
var newName = Console.ReadLine(); var newName = Console.ReadLine();
foreach (var path in Directory.EnumerateDirectories("./", $"*{oldName}*", foreach (var path in Directory.EnumerateDirectories("../", $"*{oldName}*",
SearchOption.AllDirectories)) SearchOption.AllDirectories))
{ {
Console.Write($"{path} --> "); Console.Write($"{path} --> ");
@ -16,7 +16,7 @@ foreach (var path in Directory.EnumerateDirectories("./", $"*{oldName}*",
Console.WriteLine(); Console.WriteLine();
foreach (var path in Directory.EnumerateFiles("./", $"*.*", SearchOption.AllDirectories)) foreach (var path in Directory.EnumerateFiles("../", $"*.*", SearchOption.AllDirectories))
{ {
File.WriteAllText(path, File.ReadAllText(path).Replace(oldName, newName)); File.WriteAllText(path, File.ReadAllText(path).Replace(oldName, newName));
var newPath = path.Replace(oldName, newName); var newPath = path.Replace(oldName, newName);

View File

@ -1,8 +1,8 @@
{ {
"solution": "NetAdmin.sln", "solution": "NetAdmin.sln",
"mappings": { "mappings": {
"FreeSql.NS": "./refs/FreeSql/FreeSql/FreeSql.csproj", "FreeSql.NS": "../refs/FreeSql/FreeSql/FreeSql.csproj",
"FreeSql.DbContext.NS": "./refs/FreeSql/FreeSql.DbContext/FreeSql.DbContext.csproj" "FreeSql.DbContext.NS": "../refs/FreeSql/FreeSql.DbContext/FreeSql.DbContext.csproj"
}, },
"restore": [ "restore": [
{ {

View File

@ -1,7 +1,7 @@
{ {
"solution": "NetAdmin.sln", "solution": "NetAdmin.sln",
"mappings": { "mappings": {
"Furion.Pure.NS": "./refs/Furion/framework/Furion.Pure/Furion.Pure.csproj" "Furion.Pure.NS": "../refs/Furion/framework/Furion.Pure/Furion.Pure.csproj"
}, },
"restore": [ "restore": [
{ {

View File

@ -1,7 +1,7 @@
{ {
"solution": "NetAdmin.sln", "solution": "NetAdmin.sln",
"mappings": { "mappings": {
"NSExt": "./refs/ns-ext/src/NSExt/NSExt.csproj" "NSExt": "../refs/ns-ext/src/NSExt/NSExt.csproj"
}, },
"restore": [ "restore": [
{ {

View File

@ -23,5 +23,5 @@ while ($null -eq $files[[int]$file - 1])
} }
$file = [int]$file - 1 $file = [int]$file - 1
Copy-Item $files[$file] 'switcher.json' -Force Copy-Item $files[$file] 'switcher.json' -Force
dotnet dnt $targets[$key] dotnet dnt $targets[$key] ../NetAdmin.sln
Remove-Item switcher.json Remove-Item switcher.json

View File

@ -1,6 +1,6 @@
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
var slnFile = Directory.GetFiles(@"./", "*.sln").First(); var slnFile = Directory.GetFiles(@"../", "*.sln").First();
var content = File.ReadAllText(slnFile); var content = File.ReadAllText(slnFile);
content = Regex.Replace( content = Regex.Replace(
@ -10,7 +10,7 @@ content = Regex.Replace(
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "meta", "meta", "{5198A03D-0CAC-4828-A807-34A693F73859}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "meta", "meta", "{5198A03D-0CAC-4828-A807-34A693F73859}"
{{'\t'}}ProjectSection(SolutionItems) = preProject {{'\t'}}ProjectSection(SolutionItems) = preProject
{{string.Join('\n', {{string.Join('\n',
Directory.GetFiles(@"./", "*").Where(x => !x.EndsWith(".sln") && !x.EndsWith(".user")) Directory.GetFiles(@"../", "*").Where(x => !x.EndsWith(".sln") && !x.EndsWith(".user"))
.Select(x=>$"\t\t{Path.GetFileName(x)} = {Path.GetFileName(x)}") .Select(x=>$"\t\t{Path.GetFileName(x)} = {Path.GetFileName(x)}")
)}} )}}
{{'\t'}}EndProject {{'\t'}}EndProject
@ -24,12 +24,26 @@ content = Regex.Replace(
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{3C6F049E-3EE8-4D66-9AFF-E8A369032487}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{3C6F049E-3EE8-4D66-9AFF-E8A369032487}"
{{'\t'}}ProjectSection(SolutionItems) = preProject {{'\t'}}ProjectSection(SolutionItems) = preProject
{{string.Join('\n', {{string.Join('\n',
Directory.GetFiles(@"./.github/workflows", "*").Where(x => !x.EndsWith(".sln") && !x.EndsWith(".user")) Directory.GetFiles(@"../.github/workflows", "*")
.Select(x=>$"\t\t{Path.GetFileName(x)} = .github/workflows/{Path.GetFileName(x)}") .Select(x=>$"\t\t{Path.GetFileName(x)} = .github/workflows/{Path.GetFileName(x)}")
)}} )}}
{{'\t'}}EndProject {{'\t'}}EndProject
""" """
); );
content = Regex.Replace(
content,
"Project\\(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\"\\) = \"scripts\", \"scripts\", \"{BB0B25C9-0901-4923-913F-00F9A6B352A5}\"(?:.|\n)*?EndProject",
$$"""
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{BB0B25C9-0901-4923-913F-00F9A6B352A5}"
{{'\t'}}ProjectSection(SolutionItems) = preProject
{{string.Join('\n',
Directory.GetFiles(@"../scripts", "*")
.Select(x=>$"\t\t{Path.GetFileName(x)} = scripts/{Path.GetFileName(x)}")
)}}
{{'\t'}}EndProject
"""
);
Console.WriteLine(content); Console.WriteLine(content);
File.WriteAllText(slnFile, content); File.WriteAllText(slnFile, content);