Skip to content

Commit f7187e1

Browse files
committed
fix: 修复 NETSDK1151 错误,允许 WinForms 引用 CLI exe 项目
--bug=83
1 parent 7fb2c1a commit f7187e1

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

src/IME WL Converter Win/IME WL Converter Win.csproj

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
<UseWindowsForms>true</UseWindowsForms>
3838
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
3939
<Platforms>AnyCPU;x86</Platforms>
40+
41+
<!-- 允许引用 ImeWlConverterCmd.exe(NETSDK1151 规避,必须放消费方) -->
42+
<ValidateExecutableReferencesMatchSelfContained>false</ValidateExecutableReferencesMatchSelfContained>
4043
</PropertyGroup>
4144
<PropertyGroup>
4245
<ManifestCertificateThumbprint>D023E0A7D1F29511E571C5D888823CF5150F5061</ManifestCertificateThumbprint>
@@ -96,40 +99,38 @@ GitHub: https://github.com/studyzy/imewlconverter</Description>
9699
<!-- Release发布优化配置 -->
97100
<DebugType>none</DebugType>
98101
<DebugSymbols>false</DebugSymbols>
99-
102+
100103
<!-- 禁用代码裁剪 (Windows Forms不支持trimming) -->
101104
<PublishTrimmed>false</PublishTrimmed>
102-
103-
<!-- 单文件发布 -->
105+
106+
<!-- 单文件发布(兼容 self-contained 与 framework-dependent) -->
104107
<PublishSingleFile>true</PublishSingleFile>
105108
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
106-
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
107-
108-
<!-- 启用ReadyToRun优化 -->
109-
<PublishReadyToRun>true</PublishReadyToRun>
110-
109+
111110
<!-- 不包含PDB文件 -->
112111
<CopyOutputSymbolsToPublishDirectory>false</CopyOutputSymbolsToPublishDirectory>
113112
</PropertyGroup>
114113
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
115114
<!-- Release发布优化配置 -->
116115
<DebugType>none</DebugType>
117116
<DebugSymbols>false</DebugSymbols>
118-
117+
119118
<!-- 禁用代码裁剪 (Windows Forms不支持trimming) -->
120119
<PublishTrimmed>false</PublishTrimmed>
121-
122-
<!-- 单文件发布 -->
120+
121+
<!-- 单文件发布(兼容 self-contained 与 framework-dependent) -->
123122
<PublishSingleFile>true</PublishSingleFile>
124123
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
125-
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
126-
127-
<!-- 启用ReadyToRun优化 -->
128-
<PublishReadyToRun>true</PublishReadyToRun>
129-
124+
130125
<!-- 不包含PDB文件 -->
131126
<CopyOutputSymbolsToPublishDirectory>false</CopyOutputSymbolsToPublishDirectory>
132127
</PropertyGroup>
128+
129+
<!-- 仅在 self-contained 发布时启用 ReadyToRun 与单文件压缩(framework-dependent 不支持) -->
130+
<PropertyGroup Condition="'$(Configuration)'=='Release' and '$(SelfContained)'=='true'">
131+
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
132+
<PublishReadyToRun>true</PublishReadyToRun>
133+
</PropertyGroup>
133134
<ItemGroup>
134135
<PackageReference Include="Microsoft.Office.Interop.Word" Version="15.0.4797.1004" />
135136
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.7" />

0 commit comments

Comments
 (0)