在下面有些人为的代码片段中,我创建了一个控制器方法,它构成 ASP.NET Core MVC API 的一部分。该方法用ProducesResponseType属性修饰,指示响应类型是 a 是否正确Stream,或者响应类型应该是FileStreamResult?
[HttpPost("APIFunctionCall")]
[ProducesResponseType(typeof(Stream), 200)]
public async Task<IActionResult> ProcessNewRequestAsync(Request request)
{
FileStream fs = File.Open(request.Path, FileMode.Open, FileAccess.Read, FileShare.None)
return returnValue = new FileStreamResult(fs, new MediaTypeHeaderValue("application/ms-word"));
}
Run Code Online (Sandbox Code Playgroud) 我收到错误消息light.exe,表明在我的安装项目中找到文件之一时出现问题。在有问题的PC上发现我正在使用的相对路径超过260个字符。目前,Wix设置如下:
<File Id='FoobarEXE' Name='FoobarAppl10.exe' DiskId='1' Source='..\..\Path\To\Built\Executable\FoobarAppl10.exe' KeyPath='yes'/>
Run Code Online (Sandbox Code Playgroud)
我的问题是Wix安装项目位于文件夹中,D:\Path\To\ProjectFolder\WixInstaller\WixInstallerProject并且\Path\To\Built\Executable\FoobarAppl10.exe存在于该D:\Path\To\ProjectFolder文件夹下。当light.exe尝试解析路径时,最终结果是D:\Path\To\ProjectFolder\WixInstaller\WixInstallerProject\..\..\Path\To\Built\Executable\FoobarAppl10.exe在我的特殊情况下恰好超过260个字符。exe的正确绝对路径D:\Path\To\ProjectFolder\Path\To\Built\Executable\FoobarAppl10.exe在我的情况下应为260个字符以下,但由于不必要地包含WixInstaller\WixInstallerProject\..\..\了该路径的一部分,因此超出了此限制。
有什么办法,我能得到light.exe的刚毅..\..\Path\To\Built\Executable\FoobarAppl10.exe作为D:\Path\To\ProjectFolder\Path\To\Built\Executable\FoobarAppl10.exe代替D:\Path\To\ProjectFolder\WixInstaller\WixInstallerProject\..\..\Path\To\Built\Executable\FoobarAppl10.exe?
我意识到这并不是Wix本身的限制,而是Wix设计用来利用API的方式的更多潜在限制,但是我需要一个解决问题的方法,使我可以在.wxs文件中修复此问题。是的,缩短路径是可以的,但是问题实际上不是路径太长(因为不是),而是相对路径的语法添加了不必要的中间部分。