From bf8dd98013c7c268a485a2b6640a6de4c83dd7b6 Mon Sep 17 00:00:00 2001 From: Amazing_DM Date: Thu, 19 Mar 2020 17:24:15 +0800 Subject: [PATCH] =?UTF-8?q?:construction=5Fworker:=E6=B7=BB=E5=8A=A0CI?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dotnetcore.yml | 36 +++++ Netch/Netch.csproj | 188 ++++++++++++++------------ Netch/Properties/Settings.Designer.cs | 42 +++--- build.ps1 | 69 ++++++++++ 4 files changed, 223 insertions(+), 112 deletions(-) create mode 100644 .github/workflows/dotnetcore.yml create mode 100644 build.ps1 diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml new file mode 100644 index 00000000..8f2e80b1 --- /dev/null +++ b/.github/workflows/dotnetcore.yml @@ -0,0 +1,36 @@ +name: GitHub CI .Net 4.8 +on: [push] + +jobs: + build: + name: Build + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + + - name: submodules-init + uses: snickerbockers/submodules-init@v4 + + - uses: nuget/setup-nuget@v1 + - run: nuget restore Netch.sln + + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v1.0.0 + + - name: Build .NET 4.8 Netch + shell: pwsh + run: | + .\build.ps1 + + - name: Upload Netch.x64 + uses: actions/upload-artifact@v1 + with: + name: Netch.X64 + path: Netch\bin\x64\Release\win-x64 + + - name: Upload Netch.x86 + uses: actions/upload-artifact@v1 + with: + name: Netch.X86 + path: Netch\bin\x86\Release\win-x86 diff --git a/Netch/Netch.csproj b/Netch/Netch.csproj index 56858fbb..92193351 100644 --- a/Netch/Netch.csproj +++ b/Netch/Netch.csproj @@ -1,101 +1,111 @@ - + - - WinExe - net48 - true - true - false - Netch.Netch - App.manifest - Netch.ico - x86;x64 - false - latest - + + WinExe + net48 + true + true + false + Netch.Netch + App.manifest + Netch.ico + x86;x64 + false + latest + - - bin\x64\Debug\ - DEBUG;TRACE - true - false - - - + + bin\x64\Debug\ + DEBUG;TRACE + true + false + + + - - DEBUG;TRACE - true - - false - - bin\x86\Debug\ - + + DEBUG;TRACE + true + + false + + bin\x86\Debug\ + - - true - - false - - bin\x86\Release\ - + + true + + false + + bin\x86\Release\ + - - true - - false - - bin\x64\Release\ - + + true + + false + + bin\x64\Release\ + - - - + + + - - - e34cb9f1-c7f7-424c-be29-027dcc09363a - 1 - 0 - tlbimp - 0 - false - false - - + + + e34cb9f1-c7f7-424c-be29-027dcc09363a + 1 + 0 + tlbimp + 0 + false + false + + - - - - - - - - + + + + + + + + - - - - - + + + + + - - - True - True - Resources.resx - - + + + True + True + Resources.resx + + + True + True + Settings.settings + + - - - ResXFileCodeGenerator - Resources.Designer.cs - - + + + ResXFileCodeGenerator + Resources.Designer.cs + + - - - - - \ No newline at end of file + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + diff --git a/Netch/Properties/Settings.Designer.cs b/Netch/Properties/Settings.Designer.cs index 5c2d0e38..34e4a28d 100644 --- a/Netch/Properties/Settings.Designer.cs +++ b/Netch/Properties/Settings.Designer.cs @@ -1,30 +1,26 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 // //------------------------------------------------------------------------------ -namespace Netch.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } +namespace Netch.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } } diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 00000000..b086eb16 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,69 @@ +# REM The reason we don't use dotnet build is that dotnet build doesn't support COM references yet https://github.com/microsoft/msbuild/issues/3986 +param([string]$buildtfm = 'all') + +Write-Host 'dotnet SDK version' +dotnet --version + +$exe = 'Netch.exe' +$mainDir = (Get-Item -Path ".\").FullName +$net_baseoutput = "$mainDir\Netch\bin\$configuration" + +Write-Host $mainDir +Write-Host $net_baseoutput + +function Build-NetFrameworkx64 +{ + Write-Host 'Building .NET Framework x64' + + $outdir = "$net_baseoutput\x64" + + msbuild -v:m -m -t:Build /p:Configuration="Release" /p:Platform="x64" /p:TargetFramework=net48 /p:Runtimeidentifier=win-x64 /restore + if ($LASTEXITCODE) { cd $mainDir ; exit $LASTEXITCODE } + + Write-Host 'Build x64 Complete ,Started Copy bin,mode,i18n file' + +Copy-Item "$mainDir\binaries\x64\*" "$net_baseoutput\x64\Release\win-x64\bin" +Copy-Item "$mainDir\binaries\x64\tap-driver" "$net_baseoutput\x64\Release\win-x64\bin\tap-driver" -recurse +Copy-Item "$mainDir\binaries\*.acl" "$net_baseoutput\x64\Release\win-x64\bin" +Copy-Item "$mainDir\binaries\*.conf" "$net_baseoutput\x64\Release\win-x64\bin" +Copy-Item "$mainDir\binaries\*.dat" "$net_baseoutput\x64\Release\win-x64\bin" +Copy-Item "$mainDir\binaries\*.exe" "$net_baseoutput\x64\Release\win-x64\bin" +Move-Item "$net_baseoutput\x64\Release\win-x64\bin\nfapinet.dll" "$net_baseoutput\x64\Release\win-x64\nfapinet.dll" +Copy-Item "$mainDir\translations\i18n" "$net_baseoutput\x64\Release\win-x64\i18n" -recurse +mkdir "$net_baseoutput\x64\Release\win-x64\mode" +Copy-Item "$mainDir\modes\mode\*.txt" "$net_baseoutput\x64\Release\win-x64\mode" + + Write-Host 'x64 ALL DONE' + +} +function Build-NetFrameworkx86 +{ + Write-Host 'Building .NET Framework x86' + + $outdir = "$net_baseoutput\x86" + + msbuild -v:m -m -t:Build /p:Configuration="Release" /p:Platform="x86" /p:TargetFramework=net48 /p:Runtimeidentifier=win-x86 /restore + if ($LASTEXITCODE) { cd $mainDir ; exit $LASTEXITCODE } + + Write-Host 'Build x86 Complete ,Started Copy bin,mode,i18n file' + +Copy-Item "$mainDir\binaries\x86\*" "$net_baseoutput\x86\Release\win-x86\bin" +Copy-Item "$mainDir\binaries\x86\tap-driver" "$net_baseoutput\x86\Release\win-x86\bin\tap-driver" -recurse +Copy-Item "$mainDir\binaries\*.acl" "$net_baseoutput\x86\Release\win-x86\bin" +Copy-Item "$mainDir\binaries\*.conf" "$net_baseoutput\x86\Release\win-x86\bin" +Copy-Item "$mainDir\binaries\*.dat" "$net_baseoutput\x86\Release\win-x86\bin" +Copy-Item "$mainDir\binaries\*.exe" "$net_baseoutput\x86\Release\win-x86\bin" +Move-Item "$net_baseoutput\x86\Release\win-x86\bin\nfapinet.dll" "$net_baseoutput\x86\Release\win-x86\nfapinet.dll" +Copy-Item "$mainDir\translations\i18n" "$net_baseoutput\x86\Release\win-x86\i18n" -recurse +mkdir "$net_baseoutput\x86\Release\win-x86\mode" +Copy-Item "$mainDir\modes\mode\*.txt" "$net_baseoutput\x86\Release\win-x86\mode" + + Write-Host 'x86 ALL DONE' +} + +cd $mainDir\Netch + +Build-NetFrameworkx64 +Build-NetFrameworkx86 + +cd $mainDir