我想在以下目录中编译并输出 Visual Studio 2022/.NET 6.0 WinForm 项目的 exe/dll:
GB3
:包含 exe/dll 的根目录
--config
:calibration.txt,appsettings.json
--logs
:日志文件
--db
:sqlite 数据库
config、logs 和 db 是子文件夹。
我右键单击项目->属性->输出->基本输出路径
,将GB3
设置为基本输出路径。
现在的问题是 Visual Studio 在 GB3
下自动创建 \Debug\net6.0-windows
文件夹,并在 GB3\下输出 exe 和 dll Debug\net6.0-windows
而不是简单地在“GB3”下。如何在“GB3”下输出 exe 和 dll,而不是在 GB3\Debug\net6.0-windows
下输出?非常感谢提前
最佳答案
您还需要使用 OutputPath
而不是 BaseOutputPath
,项目文件应如下所示。
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<OutputPath>GB3\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
</Project>
关于c# - Visual Studio WinForm 应用程序应编译并输出到特定目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76549996/