-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
I am using a. NET 8 winform program, which can run directly in VS2022 without any issues. However, when packaged as a. msix package and installed on my computer, an error message appears as shown in the picture above.
May I ask how to solve this?
my codes:
public Form1()
{
InitializeComponent();
//this.BackColor = System.Drawing.Color.FromArgb(40, 48, 51);
InitModel();
}
private void InitModel()
{
try
{
// 获取当前应用的安装目录
//string model_folder = Path.Combine(AppContext.BaseDirectory, "model");
string app_folder = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
string model_folder = Path.Combine(app_folder, "model");
// 构建完整的模型路径
var fluxPath = Path.Combine(model_folder, "flux1-schnell-q4_k.gguf");
var clipPath = Path.Combine(model_folder, "clip_l.safetensors");
var t5xxlPath = Path.Combine(model_folder, "t5xxl_fp8_e4m3fn.safetensors");
var aePath = Path.Combine(model_folder, "ae.safetensors");
// 初始化模型
model = ModelBuilder.Flux(fluxPath, clipPath, t5xxlPath, aePath)
.WithMultithreading()
.Build();
// 如果有需要,可以在模型初始化后执行其他任务
}
catch (Exception ex)
{
// 记录错误日志
System.Diagnostics.Debug.WriteLine($"Model initialization failed: {ex.Message}");
// 显示错误信息给用户
MessageBox.Show(this, $"Model initialization failed: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
Metadata
Metadata
Assignees
Labels
No labels