backup: 不使用vs默认项目目录结构 --CSharp

 

不使用 VisualStudio 默认项目目录结构

新建方案 和 两个项目

1 # PowerShell
2 
3 dotnet new sln --name example
4 
5 dotnet new console --name Hello1 --output src/Hello1 --use-program-main
6 dotnet new console --name Hello2 --output src/Hello2 --use-program-main
7 
8 dotnet sln add src/Hello1
9 dotnet sln add src/Hello2

 

在 example.sln 旁边放一个文件 Directory.Build.props

 1 <Project>
 2   <!--
 3     https://learn.microsoft.com/zh-cn/visualstudio/msbuild/customize-by-directory?view=vs-2022
 4     https://learn.microsoft.com/zh-cn/visualstudio/msbuild/msbuild-reserved-and-well-known-properties?view=vs-2022
 5   -->
 6   <PropertyGroup>
 7     <BaseOutputPath>$(MSBuildThisFileDirectory)bin\$(MSBuildProjectName)</BaseOutputPath>
 8     <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">$(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
 9     <!--
10     <UseCommonOutputDirectory>true</UseCommonOutputDirectory>
11      -->
12   </PropertyGroup>    
13 </Project>

 

 

--see-also

https://learn.microsoft.com/zh-cn/dotnet/core/tools/dotnet

 

--- THE END ---

 

posted @ 2024-12-29 21:54  太初谷神  阅读(16)  评论(0)    收藏  举报