diff --git a/src/Snap.Hutao/Snap.Hutao.SourceGeneration/Automation/AttributeGenerator.cs b/src/Snap.Hutao/Snap.Hutao.SourceGeneration/Automation/AttributeGenerator.cs
new file mode 100644
index 00000000..48c1846c
--- /dev/null
+++ b/src/Snap.Hutao/Snap.Hutao.SourceGeneration/Automation/AttributeGenerator.cs
@@ -0,0 +1,147 @@
+// Copyright (c) DGP Studio. All rights reserved.
+// Licensed under the MIT license.
+
+using Microsoft.CodeAnalysis;
+
+namespace Snap.Hutao.SourceGeneration.Automation;
+
+[Generator(LanguageNames.CSharp)]
+internal sealed class AttributeGenerator : IIncrementalGenerator
+{
+ public void Initialize(IncrementalGeneratorInitializationContext context)
+ {
+ context.RegisterPostInitializationOutput(GenerateAllAttributes);
+ }
+
+ public static void GenerateAllAttributes(IncrementalGeneratorPostInitializationContext context)
+ {
+ string coreAnnotations = """
+ using System.Diagnostics;
+
+ namespace Snap.Hutao.Core.Annotation;
+
+ [AttributeUsage(AttributeTargets.Method, Inherited = false)]
+ internal sealed class CommandAttribute : Attribute
+ {
+ public CommandAttribute(string name)
+ {
+ }
+
+ public bool AllowConcurrentExecutions { get; set; }
+ }
+
+ [AttributeUsage(AttributeTargets.Class, Inherited = false)]
+ internal sealed class ConstructorGeneratedAttribute : Attribute
+ {
+ public ConstructorGeneratedAttribute()
+ {
+ }
+
+ public bool CallBaseConstructor { get; set; }
+ public bool ResolveHttpClient { get; set; }
+ }
+
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
+ internal sealed class DependencyPropertyAttribute : Attribute
+ {
+ public DependencyPropertyAttribute(string name, Type type)
+ {
+ }
+
+ public DependencyPropertyAttribute(string name, Type type, object defaultValue)
+ {
+ }
+
+ public DependencyPropertyAttribute(string name, Type type, object defaultValue, string valueChangedCallbackName)
+ {
+ }
+
+ public bool IsAttached { get; set; }
+ public Type AttachedType { get; set; } = default;
+ }
+
+ [AttributeUsage(AttributeTargets.All, Inherited = false)]
+ [Conditional("DEBUG")]
+ internal sealed class HighQualityAttribute : Attribute
+ {
+ }
+ """;
+ context.AddSource("Snap.Hutao.Core.Annotation.Attributes.g.cs", coreAnnotations);
+
+ string coreDependencyInjectionAnnotationHttpClients = """
+ namespace Snap.Hutao.Core.DependencyInjection.Annotation.HttpClient;
+
+ [AttributeUsage(AttributeTargets.Class, Inherited = false)]
+ internal sealed class HttpClientAttribute : Attribute
+ {
+ public HttpClientAttribute(HttpClientConfiguration configuration)
+ {
+ }
+
+ public HttpClientAttribute(HttpClientConfiguration configuration, Type interfaceType)
+ {
+ }
+ }
+
+ internal enum HttpClientConfiguration
+ {
+ ///
+ /// 默认配置
+ ///
+ Default,
+
+ ///
+ /// 米游社请求配置
+ ///
+ XRpc,
+
+ ///
+ /// 米游社登录请求配置
+ ///
+ XRpc2,
+
+ ///
+ /// Hoyolab app
+ ///
+ XRpc3,
+ }
+
+ [AttributeUsage(AttributeTargets.Class, Inherited = false)]
+ internal sealed class PrimaryHttpMessageHandlerAttribute : Attribute
+ {
+ ///
+ public int MaxConnectionsPerServer { get; set; }
+
+ ///
+ ///
+ ///
+ public bool UseCookies { get; set; }
+ }
+ """;
+ context.AddSource("Snap.Hutao.Core.DependencyInjection.Annotation.HttpClient.Attributes.g.cs", coreDependencyInjectionAnnotationHttpClients);
+
+ string coreDependencyInjectionAnnotations = """
+ namespace Snap.Hutao.Core.DependencyInjection.Annotation;
+
+ internal enum InjectAs
+ {
+ Singleton,
+ Transient,
+ Scoped,
+ }
+
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
+ internal sealed class InjectionAttribute : Attribute
+ {
+ public InjectionAttribute(InjectAs injectAs)
+ {
+ }
+
+ public InjectionAttribute(InjectAs injectAs, Type interfaceType)
+ {
+ }
+ }
+ """;
+ context.AddSource("Snap.Hutao.Core.DependencyInjection.Annotation.Attributes.g.cs", coreDependencyInjectionAnnotations);
+ }
+}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/Core/Annotation/CommandAttribute.cs b/src/Snap.Hutao/Snap.Hutao/Core/Annotation/CommandAttribute.cs
deleted file mode 100644
index e7fcd4f2..00000000
--- a/src/Snap.Hutao/Snap.Hutao/Core/Annotation/CommandAttribute.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) DGP Studio. All rights reserved.
-// Licensed under the MIT license.
-
-namespace Snap.Hutao.Core.Annotation;
-
-///
-/// 指示此方法为命令的调用方法
-///
-[AttributeUsage(AttributeTargets.Method, Inherited = false)]
-internal sealed class CommandAttribute : Attribute
-{
- ///
- /// 指示此方法为命令的调用方法
- ///
- /// 命令名称
- public CommandAttribute(string name)
- {
- }
-
- ///
- /// 是否允许并行执行
- ///
- public bool AllowConcurrentExecutions { get; set; }
-}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/Core/Annotation/ConstructorGeneratedAttribute.cs b/src/Snap.Hutao/Snap.Hutao/Core/Annotation/ConstructorGeneratedAttribute.cs
deleted file mode 100644
index 5b31cb73..00000000
--- a/src/Snap.Hutao/Snap.Hutao/Core/Annotation/ConstructorGeneratedAttribute.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) DGP Studio. All rights reserved.
-// Licensed under the MIT license.
-
-namespace Snap.Hutao.Core.Annotation;
-
-///
-/// 指示此类自动生成构造器
-///
-[AttributeUsage(AttributeTargets.Class, Inherited = false)]
-internal sealed class ConstructorGeneratedAttribute : Attribute
-{
- ///
- /// 指示此类自动生成构造器
- ///
- public ConstructorGeneratedAttribute()
- {
- }
-
- ///
- /// 是否调用基类构造函数
- ///
- public bool CallBaseConstructor { get; set; }
-
- ///
- /// 在构造函数中插入 HttpClient
- ///
- public bool ResolveHttpClient { get; set; }
-}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/Core/Annotation/DependencyPropertyAttribute.cs b/src/Snap.Hutao/Snap.Hutao/Core/Annotation/DependencyPropertyAttribute.cs
deleted file mode 100644
index 03f26cdd..00000000
--- a/src/Snap.Hutao/Snap.Hutao/Core/Annotation/DependencyPropertyAttribute.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) DGP Studio. All rights reserved.
-// Licensed under the MIT license.
-
-namespace Snap.Hutao.Core.Annotation;
-
-[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
-internal sealed class DependencyPropertyAttribute : Attribute
-{
- public DependencyPropertyAttribute(string name, Type type)
- {
- }
-
- public DependencyPropertyAttribute(string name, Type type, object defaultValue)
- {
- }
-
- public DependencyPropertyAttribute(string name, Type type, object defaultValue, string valueChangedCallbackName)
- {
- }
-
- public bool IsAttached { get; set; }
-
- public Type AttachedType { get; set; } = default!;
-}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/Core/Annotation/HighQualityAttribute.cs b/src/Snap.Hutao/Snap.Hutao/Core/Annotation/HighQualityAttribute.cs
deleted file mode 100644
index 901ae9ec..00000000
--- a/src/Snap.Hutao/Snap.Hutao/Core/Annotation/HighQualityAttribute.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) DGP Studio. All rights reserved.
-// Licensed under the MIT license.
-
-using System.Diagnostics;
-
-namespace Snap.Hutao.Core.Annotation;
-
-///
-/// 高质量代码
-///
-[AttributeUsage(AttributeTargets.All, Inherited = false)]
-[Conditional("DEBUG")]
-internal sealed class HighQualityAttribute : Attribute
-{
-}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/Annotation/HttpClient/HttpClientAttribute.cs b/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/Annotation/HttpClient/HttpClientAttribute.cs
deleted file mode 100644
index 03df6c9d..00000000
--- a/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/Annotation/HttpClient/HttpClientAttribute.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) DGP Studio. All rights reserved.
-// Licensed under the MIT license.
-
-namespace Snap.Hutao.Core.DependencyInjection.Annotation.HttpClient;
-
-///
-/// 指示被标注的类型可注入 HttpClient
-/// 由源生成器生成注入代码
-///
-[HighQuality]
-[AttributeUsage(AttributeTargets.Class, Inherited = false)]
-internal sealed class HttpClientAttribute : Attribute
-{
- ///
- /// 构造一个新的特性
- ///
- /// 配置
- public HttpClientAttribute(HttpClientConfiguration configuration)
- {
- }
-
- ///
- /// 构造一个新的特性
- ///
- /// 配置
- /// 实现的接口类型
- public HttpClientAttribute(HttpClientConfiguration configuration, Type interfaceType)
- {
- }
-}
diff --git a/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/Annotation/HttpClient/HttpClientConfiguration.cs b/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/Annotation/HttpClient/HttpClientConfiguration.cs
deleted file mode 100644
index 337bf1fd..00000000
--- a/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/Annotation/HttpClient/HttpClientConfiguration.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) DGP Studio. All rights reserved.
-// Licensed under the MIT license.
-
-namespace Snap.Hutao.Core.DependencyInjection.Annotation.HttpClient;
-
-///
-/// Http客户端配置
-///
-[HighQuality]
-internal enum HttpClientConfiguration
-{
- ///
- /// 默认配置
- ///
- Default,
-
- ///
- /// 米游社请求配置
- ///
- XRpc,
-
- ///
- /// 米游社登录请求配置
- ///
- XRpc2,
-
- ///
- /// Hoyolab app
- ///
- XRpc3,
-}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/Annotation/HttpClient/PrimaryHttpMessageHandlerAttribute.cs b/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/Annotation/HttpClient/PrimaryHttpMessageHandlerAttribute.cs
deleted file mode 100644
index 00c1b743..00000000
--- a/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/Annotation/HttpClient/PrimaryHttpMessageHandlerAttribute.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) DGP Studio. All rights reserved.
-// Licensed under the MIT license.
-
-namespace Snap.Hutao.Core.DependencyInjection.Annotation.HttpClient;
-
-///
-/// 配置首选Http消息处理器特性
-///
-[HighQuality]
-[AttributeUsage(AttributeTargets.Class, Inherited = false)]
-internal sealed class PrimaryHttpMessageHandlerAttribute : Attribute
-{
- ///
- public int MaxConnectionsPerServer { get; set; }
-
- ///
- ///
- ///
- public bool UseCookies { get; set; }
-}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/Annotation/InjectAs.cs b/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/Annotation/InjectAs.cs
deleted file mode 100644
index dbe76305..00000000
--- a/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/Annotation/InjectAs.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) DGP Studio. All rights reserved.
-// Licensed under the MIT license.
-
-namespace Snap.Hutao.Core.DependencyInjection.Annotation;
-
-///
-/// 注入方法
-///
-[HighQuality]
-internal enum InjectAs
-{
- ///
- /// 指示应注册为单例对象
- ///
- Singleton,
-
- ///
- /// 指示应注册为短期对象
- ///
- Transient,
-
- ///
- /// 指示应注册为范围对象
- ///
- Scoped,
-}
diff --git a/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/Annotation/InjectionAttribute.cs b/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/Annotation/InjectionAttribute.cs
deleted file mode 100644
index a92e08c5..00000000
--- a/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/Annotation/InjectionAttribute.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) DGP Studio. All rights reserved.
-// Licensed under the MIT license.
-
-namespace Snap.Hutao.Core.DependencyInjection.Annotation;
-
-///
-/// 指示被标注的类型可注入
-/// 由源生成器生成注入代码
-///
-[HighQuality]
-[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
-internal sealed class InjectionAttribute : Attribute
-{
- ///
- /// 指示该类将注入为不带有接口实现的类
- ///
- /// 指示注入方法
- public InjectionAttribute(InjectAs injectAs)
- {
- }
-
- ///
- /// 指示该类将注入为带有接口实现的类
- ///
- /// 指示注入方法
- /// 实现的接口类型
- public InjectionAttribute(InjectAs injectAs, Type interfaceType)
- {
- }
-}
\ No newline at end of file