如何从外部工作目录中执行dotnet .dll

发布于 2025-02-12 01:53:21 字数 627 浏览 0 评论 0原文

我正在尝试从外部执行dotnet .dll,其构建目录(工作目录)。

当我这样做时,appsettings.json文件将被忽略。

有没有办法设置工作目录?或者我可以指定AppSettings.json文件的位置?

类似的内容:

# option A:
$env:DOTNET_WORKING_DIRECOTRY = "C:\root\build"
dotnet c:\root\build\hello.dll

# option B:
dotnet c:\root\build\hello.dll --appsettings c:\root\build\appsettings.json

详细信息

C:\root
└───build
    ├───appsettings.json
    └───hello.dll

工作:

cd C:\root\build
dotnet hello.dll

不起作用(忽略AppSettings.json):

cd C:\root
dotnet build/hello.dll

I am trying to execute a dotnet .dll from outside it's build directory (working directory).

When I do that the appsettings.json file is ignored.

Is there a way to set the working directory? Or can I specify where the appsettings.json file is located?

something like that:

# option A:
$env:DOTNET_WORKING_DIRECOTRY = "C:\root\build"
dotnet c:\root\build\hello.dll

# option B:
dotnet c:\root\build\hello.dll --appsettings c:\root\build\appsettings.json

Details

C:\root
└───build
    ├───appsettings.json
    └───hello.dll

works:

cd C:\root\build
dotnet hello.dll

does not work (ignores appsettings.json):

cd C:\root
dotnet build/hello.dll

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文