C# dotnet运行--项目<;路径>;不将项目路径作为工作目录

C# dotnet运行--项目<;路径>;不将项目路径作为工作目录,c#,.net,.net-core,console-application,C#,.net,.net Core,Console Application,当使用.NET命令运行存储在网络驱动器上的my Console应用程序时,它会将工作目录视为调用它的位置,而不是项目路径 dotnet运行--project“\\network.drive\path\example\project” 我得到如下输出: WORKING DIRECTORY: C:\Windows\system32 Current Environment: DEV Current Root URL: <API_URL> Current Excel File: Unhan

当使用.NET命令运行存储在网络驱动器上的my Console应用程序时,它会将工作目录视为调用它的位置,而不是项目路径

dotnet运行--project“\\network.drive\path\example\project”

我得到如下输出:

WORKING DIRECTORY: C:\Windows\system32
Current Environment: DEV
Current Root URL: <API_URL>
Current Excel File:

Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: fileName
   at System.IO.FileInfo..ctor(String originalPath, String fullPath, String fileName, Boolean isNormalized)
   at System.IO.FileInfo..ctor(String fileName)
   at MyProject.Reader.ReadAgentData(Int32 sheetIndex) in \\network.drive\path\example\project\Reader.cs:line 68
   at MyProject.Program.Main(String[] args) in \\network.drive\path\example\project\Program.cs:line 119
工作目录:C:\Windows\system32
当前环境:DEV
当前根URL:
当前Excel文件:
未处理的异常:System.ArgumentNullException:值不能为null。
参数名称:fileName
位于System.IO.FileInfo..ctor(字符串原始路径、字符串完整路径、字符串文件名、布尔值已规范化)
位于System.IO.FileInfo..ctor(字符串文件名)
在\\network.drive\path\example\project\Reader.cs中的MyProject.Reader.ReadAgentData(Int32 sheetIndex):第68行
在\\network.drive\path\example\project\Program.cs中的MyProject.Program.Main(字符串[]args)处:第119行
错误是Excel文件变量为空字符串。由于工作目录不是项目的路径,而是
C:\Windows\system32
,因此无法找到从中提取信息的appsettings.json文件

奇怪的是,使用命令
dotnet watch--project“\\network.drive\path\example\project”run
会使进程正确运行,它有正确的工作目录,并且读取appsettings.json文件时不会出现问题,但显然它必须等待文件更改(监视的目的)

使用
dotnet run--project
时,如何让我的应用程序将工作目录识别为项目文件夹的根目录??(要明确的是,我不想使用watch,除非我可以让它自动结束)

看看这个GitHub。似乎不支持UNC路径看看这个GitHub。似乎不支持UNC路径