创建Solution文件,文件名为demo-solution.sln
dotnet new sln --name demo-solution
创建src
目录
mkdir src
创建Console应用项目作为App入口
dotnet new console --output src/DemoSolution.WebApp --framework net6.0 --use-program-main
将Console应用添加到Solution中
dotnet sln demo-solution.sln add src/DemoSolution.WebApp
添加依赖包
dotnet add src/DemoSolution.WebApp package package-name --version 1.0.0
配置文件夹输出
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<None Include="Configuration\**\*;">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>