Visual Studio - 根据选择的配置为多个平台构建
Visual Studio - Build for multiple platforms based on configuration chosen
我正在开发 C# 跨平台 @ .NET5 应用程序。
要为 linux 构建项目,我在每个解决方案项目的 .csproj 文件中使用 <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
,但有时我也想为 win-x64
构建项目.
是否可以编辑 .csproj 文件,以便根据构建配置选择 RID
?即类似于 Debug
或 Release
配置,我想在 Visual Studio.
中有 Linux
和 Windows
配置
我已经成功地完成了以下工作,除了它不会在使用 WSL2 调试的 Debug-Linux-x64
上的断点处中断。
<PropertyGroup Condition=" '$(Configuration)'=='Release-Linux-x64' ">
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)'=='Debug-Linux-x64' ">
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)'=='Release-Windows-x64' ">
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)'=='Debug-Windows-x64' ">
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
谢谢。
尝试修改DebugType为“portable”,专门针对跨平台。
相关link:
我正在开发 C# 跨平台 @ .NET5 应用程序。
要为 linux 构建项目,我在每个解决方案项目的 .csproj 文件中使用 <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
,但有时我也想为 win-x64
构建项目.
是否可以编辑 .csproj 文件,以便根据构建配置选择 RID
?即类似于 Debug
或 Release
配置,我想在 Visual Studio.
Linux
和 Windows
配置
我已经成功地完成了以下工作,除了它不会在使用 WSL2 调试的 Debug-Linux-x64
上的断点处中断。
<PropertyGroup Condition=" '$(Configuration)'=='Release-Linux-x64' ">
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)'=='Debug-Linux-x64' ">
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)'=='Release-Windows-x64' ">
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)'=='Debug-Windows-x64' ">
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
谢谢。
尝试修改DebugType为“portable”,专门针对跨平台。
相关link: