Skip to content

Commit

Permalink
[fix] 修复代码中使用Assembly.GetExecutingAssembly().Location与single file pub…
Browse files Browse the repository at this point in the history
…lish不兼容的问题,改为调用AppContext.BaseDirectory
  • Loading branch information
pirunxi committed Apr 17, 2024
1 parent 9ab8fe3 commit 5850f37
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Luban.Core/SimpleLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private void PostInitManagers()

private void ScanRegisterAssemblyBehaviours()
{
string dllDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string dllDir = Path.GetDirectoryName(AppContext.BaseDirectory);
foreach (var dllFile in Directory.GetFiles(dllDir, "*.dll", SearchOption.TopDirectoryOnly))
{
string dllName = Path.GetFileNameWithoutExtension(dllFile);
Expand Down
2 changes: 1 addition & 1 deletion src/Luban.Core/Tmpl/TemplateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class TemplateManager

public void Init()
{
string curDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string curDir = Path.GetDirectoryName(AppContext.BaseDirectory);
AddTemplateSearchPath($"{curDir}/Templates", true);
}

Expand Down

0 comments on commit 5850f37

Please sign in to comment.