winform sqlserver vs2026 aot 命令行发布后, 提示 返回
kk 发布于2025/12/23
] 初始化错误: 中文提示 : 连接数据库过程中发生错误,检查服务器是否正常连接字符串是否正确,错误信息:A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.DbType="SqlServer";ConfigId="".
English Message : Connection open error . A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.DbType="SqlServer";ConfigId=""
public AppFrmMain()
{
InitializeComponent();
StaticConfig.EnableAot = true;
InitializeTrayIcon();
InitializeDicomEnvironment();
}
internal SqlSugarUtil()
{
dbContext = new SqlSugarClient(new ConnectionConfig
{
ConnectionString = AppConfig.ConnectionString,
DbType = SqlSugar.DbType.SqlServer,
IsAutoCloseConnection = true
});
LogDbCommandInterceptor.Register(dbContext); // 只注册一次
}
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net10.0-windows</TargetFramework>
<RootNamespace>CStoreSCPForm</RootNamespace>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<BaseOutputPath>Y:\Test</BaseOutputPath>
<Configurations>Debug;Release;Publish</Configurations>
<InvariantGlobalization>false</InvariantGlobalization>
</PropertyGroup>
热忱回答(1)
-
fate stay night VIP0
2025/12/23看文档:aot
1、代码要启用AOT
2、要配置XML
0 回复