vipwan / Biwen.AutoClassGen

Source Gen Roslyn
MIT License
15 stars 0 forks source link

提供`添加文件头部信息`的分析器和修复器 #8

Open vipwan opened 2 months ago

vipwan commented 2 months ago

首先添加Biwen.AutoClassGen.Comment文件到项目根目录,格式如下:

请注意: 严格约定配置项的首字母大写

// Licensed to the {Product} under one or more agreements.
// The {Product} licenses this file to you under the {Copyright} license. 
// See the LICENSE file in the project root for more information.13456789
// 1234 {Product} {File} 
// {Date}  {Title} {Author} {Company}

项目文件.csproj中如果包含如下的配置项将会被引用,否则将会使用缺省值!

<Project Sdk="Microsoft.NET.Sdk.Web">
    <PropertyGroup>
        <TargetFramework>net8.0</TargetFramework>
        <Description>This is a test console App</Description>
        <Copyright>MIT</Copyright>
        <Company>Inc</Company>
        <Authors>万雅虎</Authors>
    </PropertyGroup>
    <Import Project="../Version.props" />
</Project>

支持的变量有: Date,File,Title,Author,Product,Copyright,Version

.cs源文件不存在头部信息时分析器将生成GEN050警告信息,

image

提供的修复器如下:

image