我正在使用以下发布配置文件从 Visual Studio 中发布控制台应用程序:
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Configuration>Release</Configuration>
<Platform>x64</Platform>
<TargetFramework>netcoreapp5.0</TargetFramework>
<PublishDir>bin\Release\netcoreapp5.0\publish\</PublishDir>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<SelfContained>False</SelfContained>
<PublishSingleFile>True</PublishSingleFile>
<PublishReadyToRun>True</PublishReadyToRun>
<IncludeNativeLibrariesForSelfExtract>True</IncludeNativeLibrariesForSelfExtract>
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
</Project>
我的目标是不在发布输出文件夹中发出任何 .pdb 文件(调试符号)。
这并不完全按预期工作。
控制台应用程序项目的 .pdb 文件未生成 - 正如预期的那样,但由于某种原因生成了它引用的业务逻辑项目的调试符号。这是一个错误吗?
我可以通过向业务逻辑库的项目文件中添加条件语句来解决这个问题,但是我想避免这种情况,因为我认为发布应用程序的所有相关信息都应该驻留在发布配置文件中。
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>