- .NET6默认开启全局using
- 具体配置如下
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<!--开启全局using-->
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
- 包含的命名空间如下
- using System;
- using System.IO;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.Http;
- using System.Threading;
- using System.Threading.Tasks;
- 添加自定义命名空间方法
<ItemGroup>
<Using Include="My.Awesome.Namespace" />
</ItemGroup>
- 示例地址:https://github.com/huzuohuyou/DotNet6-Examples.git