英文:
Visual Studio WinForm application should compile and output to specific directory
问题
I want to compile and output exe/dlls for Visual Studio 2022/.NET 6.0 WinForm project in the following directory:
GB3
: root dir containing exe/dlls
--config
: calibration.txt, appsettings.json
--logs
: log files
--db
: sqlite db
config, logs and db are sub-folders.
I have right-clicked on Project->Properties->Output->Base output path to set GB3 as Base output path.
Now the problem is that Visual Studio is automatically creating \Debug\net6.0-windows folder under GB3, and outputs exe and dlls under GB3\Debug\net6.0-windows instead of simply under 'GB3'. How can I output exe and dlls under 'GB3' and not GB3\Debug\net6.0-windows? Many thanks in advance
英文:
I want to compile and output exe/dlls for Visual Studio 2022/.NET 6.0 WinForm project in the following directory:
GB3
: root dir containing exe/dlls
--config
: calibration.txt, appsettings.json
--logs
: log files
--db
: sqlite db
config, logs and db are sub-folders.
I have right-clicked on Project->Properties->Output->Base output path
to set GB3
as Base output path.
Now the problem is that Visual Studio is automatically creating \Debug\net6.0-windows
folder under GB3
, and outputs exe and dlls under GB3\Debug\net6.0-windows
instead of simply under ''GB3''. How can I output exe and dlls under ''GB3'' and not GB3\Debug\net6.0-windows
? Many thanks in advance
答案1
得分: 2
<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>
英文:
You also need to use OutputPath
instead of BaseOutputPath
, the project file should look like the following.
<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>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论