From e6660f03f60ac823bbfb94a4f4df6195f4ded148 Mon Sep 17 00:00:00 2001 From: chfei Date: Thu, 6 Aug 2026 15:04:05 +0800 Subject: [PATCH] =?UTF-8?q?EnvironmentHelper=20=E5=A2=9E=E5=8A=A0=20Rease?= =?UTF-8?q?=20=E7=BC=96=E8=AF=91=20=E5=8F=AA=E5=85=81=E8=AE=B8=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 29WxOrderWpf/29WxOrderWpf.csproj | 2 +- 29WxOrderWpf/29WxOrderWpf.csproj.user | 2 +- 29WxOrderWpf/Common/EnvironmentHelper.cs | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/29WxOrderWpf/29WxOrderWpf.csproj b/29WxOrderWpf/29WxOrderWpf.csproj index c6eaf2c..4c4d938 100644 --- a/29WxOrderWpf/29WxOrderWpf.csproj +++ b/29WxOrderWpf/29WxOrderWpf.csproj @@ -19,7 +19,7 @@ pdbonly true ..\..\KJD Cef138\Bin\ - TRACE + TRACE;RELEASE diff --git a/29WxOrderWpf/29WxOrderWpf.csproj.user b/29WxOrderWpf/29WxOrderWpf.csproj.user index 607b9ea..304107f 100644 --- a/29WxOrderWpf/29WxOrderWpf.csproj.user +++ b/29WxOrderWpf/29WxOrderWpf.csproj.user @@ -10,7 +10,7 @@ zh-CN false ProjectFiles - Production + Development ProjectDebugger diff --git a/29WxOrderWpf/Common/EnvironmentHelper.cs b/29WxOrderWpf/Common/EnvironmentHelper.cs index eba41fb..b11c372 100644 --- a/29WxOrderWpf/Common/EnvironmentHelper.cs +++ b/29WxOrderWpf/Common/EnvironmentHelper.cs @@ -29,6 +29,10 @@ public class EnvironmentHelper private static string DetermineEnvironment() { +#if RELEASE + // Release 构建:只允许生产环境,不允许其他环境 + return "Production"; +#else // 1. 检查环境变量 var envVar = Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT") ?? Environment.GetEnvironmentVariable("ENVIRONMENT"); @@ -49,6 +53,7 @@ public class EnvironmentHelper // 4. 默认返回 Production return "Production"; +#endif } // 获取环境描述