Skip to content

Commit

Permalink
支持.net8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tmoonlight committed Aug 10, 2024
1 parent 6b359fb commit d1959a0
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>net8.0;netstandard2.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
25 changes: 11 additions & 14 deletions src/NSmartProxy.Data/Models/ClientApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,18 @@ public class ClientApp : ICloneable

public object Clone()
{

// Don't serialize a null object, simply return the default for that object
if (Object.ReferenceEquals(this, null))
{
return null;
}

IFormatter formatter = new BinaryFormatter();
Stream stream = new MemoryStream();
using (stream)
//返回深拷贝(不使用BinaryFormatter)
return new ClientApp
{
formatter.Serialize(stream, this);
stream.Seek(0, SeekOrigin.Begin);
return formatter.Deserialize(stream);
}
AppId = AppId,
IP = IP,
TargetServicePort = TargetServicePort,
ConsumerPort = ConsumerPort,
IsCompress = IsCompress,
Protocol = Protocol,
Host = Host,
Description = Description
};
}
}
}
4 changes: 2 additions & 2 deletions src/NSmartProxy.Data/NSmartProxy.Data.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>7.2</LangVersion>
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/NSmartProxy.ServerHost/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ENTRYPOINT ["dotnet", "NSmartProxy.ServerHost.dll"]

#need combile 1st.
FROM mcr.microsoft.com/dotnet/core/runtime:3.1 AS runtime
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS runtime
WORKDIR /app
COPY / /app/
EXPOSE 12300-22300
Expand Down
3 changes: 2 additions & 1 deletion src/NSmartProxy.ServerHost/NSmartProxy.ServerHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<PublishTrimmed>True</PublishTrimmed>
</PropertyGroup>

<ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions src/NSmartProxy/NSmartProxy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>net8.0</TargetFrameworks>
<ApplicationIcon />
<StartupObject />
<LangVersion>7.2</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand All @@ -16,6 +15,8 @@

<ItemGroup>
<PackageReference Include="litedb" Version="5.0.21" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/NSmartProxyClient/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#need combile 1st.
FROM mcr.microsoft.com/dotnet/core/runtime:3.1 AS runtime
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS runtime
WORKDIR /app
COPY / /app/
ENTRYPOINT ["dotnet", "NSmartProxyClient.dll"]
3 changes: 2 additions & 1 deletion src/NSmartProxyClient/NSmartProxyClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<PublishTrimmed>True</PublishTrimmed>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
37 changes: 20 additions & 17 deletions src/build.cmd
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
rem windows only
rem NSP v1.3
@ECHO off
rem NSP v1.4.0
@ECHO on

set Ver=v1.3_alpha
set Ver=v1.4.0
set BuildPath=%~dp0../build

set nsp_client_path=%BuildPath%/nspclient_%Ver%
set nsp_server_path=%BuildPath%/nspserver_%Ver%

set nsp_client_scd_linux_path=%BuildPath%/nspclient_scd_linux_%Ver%
set nsp_client_scd_win_path=%BuildPath%/nspclient_scd_win_%Ver%
set nsp_client_scd_osx_path=%BuildPath%/nspclient_scd_osx_%Ver%
set nsp_client_scd_linux_arm_path=%BuildPath%/nspclient_scd_linux_arm_%Ver%
set nsp_client_scd_win_arm_path=%BuildPath%/nspclient_scd_win_arm_%Ver%
set nsp_client_scd_win_path=%BuildPath%/nspclient_scd_win_x86_%Ver%
set nsp_client_scd_osx_path=%BuildPath%/nspclient_scd_osx_x86_%Ver%
set nsp_client_scd_osx_arm_path=%BuildPath%/nspclient_scd_osx_arm64_%Ver%
set nsp_client_scd_linux_arm_path=%BuildPath%/nspclient_scd_linux_arm64_%Ver%
set nsp_client_scd_win_arm_path=%BuildPath%/nspclient_scd_win_arm64_%Ver%

set nsp_server_scd_linux_path=%BuildPath%/nspserver_scd_linux_%Ver%
set nsp_server_scd_win_path=%BuildPath%/nspserver_scd_win_%Ver%
Expand All @@ -30,18 +31,20 @@ rem NSPServer
dotnet publish .\NSmartProxy.ServerHost\NSmartProxy.ServerHost.csproj -c release -o %nsp_server_path%

rem NSPClient_SCD
dotnet publish .\NSmartProxyClient\NSmartProxyClient.csproj -r linux-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true -o %nsp_client_scd_linux_path%
dotnet publish .\NSmartProxyClient\NSmartProxyClient.csproj -r win-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true -o %nsp_client_scd_win_path%
dotnet publish .\NSmartProxyClient\NSmartProxyClient.csproj -r osx-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true -o %nsp_client_scd_osx_path%
dotnet publish .\NSmartProxyClient\NSmartProxyClient.csproj -r linux-arm -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true -o %nsp_client_scd_linux_arm_path%
dotnet publish .\NSmartProxyClient\NSmartProxyClient.csproj -r win-arm -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true -o %nsp_client_scd_win_arm_path%
dotnet publish .\NSmartProxyClient\NSmartProxyClient.csproj -r linux-x64 -c Release /p:PublishSingleFile=true -o %nsp_client_scd_linux_path%
dotnet publish .\NSmartProxyClient\NSmartProxyClient.csproj -r win-x64 -c Release /p:PublishSingleFile=true -o %nsp_client_scd_win_path%
dotnet publish .\NSmartProxyClient\NSmartProxyClient.csproj -r osx-x64 -c Release /p:PublishSingleFile=true -o %nsp_client_scd_osx_path%
dotnet publish .\NSmartProxyClient\NSmartProxyClient.csproj -r osx-arm64 -c Release /p:PublishSingleFile=true -o %nsp_client_scd_osx_arm_path%
dotnet publish .\NSmartProxyClient\NSmartProxyClient.csproj -r linux-arm -c Release /p:PublishSingleFile=true -o %nsp_client_scd_linux_arm_path%
dotnet publish .\NSmartProxyClient\NSmartProxyClient.csproj -r win-arm64 -c Release /p:PublishSingleFile=true -o %nsp_client_scd_win_arm_path%

rem NSPServer_SCD
dotnet publish .\NSmartProxy.ServerHost\NSmartProxy.ServerHost.csproj -r linux-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true -o %nsp_server_scd_linux_path%
dotnet publish .\NSmartProxy.ServerHost\NSmartProxy.ServerHost.csproj -r win-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true -o %nsp_server_scd_win_path%
dotnet publish .\NSmartProxy.ServerHost\NSmartProxy.ServerHost.csproj -r osx-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true -o %nsp_server_scd_osx_path%
dotnet publish .\NSmartProxy.ServerHost\NSmartProxy.ServerHost.csproj -r linux-arm -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true -o %nsp_server_scd_linux_arm_path%
dotnet publish .\NSmartProxy.ServerHost\NSmartProxy.ServerHost.csproj -r win-arm -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true -o %nsp_server_scd_win_arm_path%
dotnet publish .\NSmartProxy.ServerHost\NSmartProxy.ServerHost.csproj -r linux-x64 -c Release /p:PublishSingleFile=true -o %nsp_server_scd_linux_path%
dotnet publish .\NSmartProxy.ServerHost\NSmartProxy.ServerHost.csproj -r win-x64 -c Release /p:PublishSingleFile=true -o %nsp_server_scd_win_path%
dotnet publish .\NSmartProxy.ServerHost\NSmartProxy.ServerHost.csproj -r osx-x64 -c Release /p:PublishSingleFile=true -o %nsp_server_scd_osx_path%
dotnet publish .\NSmartProxy.ServerHost\NSmartProxy.ServerHost.csproj -r osx-arm64 -c Release /p:PublishSingleFile=true -o %nsp_client_scd_osx_arm_path%
dotnet publish .\NSmartProxy.ServerHost\NSmartProxy.ServerHost.csproj -r linux-arm -c Release /p:PublishSingleFile=true -o %nsp_server_scd_linux_arm_path%
dotnet publish .\NSmartProxy.ServerHost\NSmartProxy.ServerHost.csproj -r win-arm64 -c Release /p:PublishSingleFile=true -o %nsp_server_scd_win_arm_path%

rem NSPWinform
MSBuild .\NSmartProxyWinform\NSmartProxyWinform.csproj /t:build /p:OutDir=%nsp_client_winfform_path%
Expand Down

0 comments on commit d1959a0

Please sign in to comment.