WIX错误:Light.exe在给出相对路径时找不到文件,但是如果给出了绝对路径,可以找到它

发布于 2025-01-20 18:17:56 字数 454 浏览 2 评论 0原文

The system cannot find the file '..\..\..\..\..\..\out\Debug\[FilePath]' with type ''.

我正在使用Wixproj中的HeatDirectory任务来从指定的目录中获取文件,但是当我使用相对路径时,它会给我这个错误,当我使用绝对路径时,它将成功构建。是否有任何解决方法或解决方案,因为我无法使用ABS路径,因为它是由团队进行的,而且我们必须使用DevOps在云中构建它。

注意:我已经阅读 httpps://sourceforge.net/pp/p/wix/wix/bugs/bugs/24445/ 这并不建议解决方案。

The system cannot find the file '..\..\..\..\..\..\out\Debug\[FilePath]' with type ''.

I am using a HeatDirectory task in wixproj to fetch files from the specified directory but when I use relative path it gives me this error and when I use absolute path it is building successfully. Is there any workaround or solution for this as I cant have abs path as it is being worked upon by a team and also we have to build it in cloud using DevOps.

Note: I have read https://sourceforge.net/p/wix/bugs/2445/ but this doesn't suggest a solution.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

反差帅 2025-01-27 18:17:56

有一些解决方案。
您可以在$(solutiondir)或$(projectDir)等属性中使用构建来省略...
或者,您可以使用如下所示的构建任务转换对象。
如果您有先进的话,甚至可以使用C#脚本。

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
    <RelativePath>..\out\Debug</RelativePath>
  </PropertyGroup>
  <Target AfterTargets="Build" Name="hallo">
    <Message Text="$(SolutionDir)out\Debug"/>        
    <ConvertToAbsolutePath Paths="$(RelativePath)">
      <Output TaskParameter="AbsolutePaths" PropertyName="AbsolutePath"/>
    </ConvertToAbsolutePath>
    <Message Text="$(AbsolutePath)"/>
    <Message Text="$([System.IO.Path]::GetFullPath('$(RelativePath)'))"/>        
  </Target>
</Project>

there are a couple of solutions to this.
You can use build in properties like $(SolutionDir) or $(ProjectDir) to be able to omit ...
Or you can use the build task ConvertToAbsolutePath as shown below.
You could even use a C# script if you prefere this.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
    <RelativePath>..\out\Debug</RelativePath>
  </PropertyGroup>
  <Target AfterTargets="Build" Name="hallo">
    <Message Text="$(SolutionDir)out\Debug"/>        
    <ConvertToAbsolutePath Paths="$(RelativePath)">
      <Output TaskParameter="AbsolutePaths" PropertyName="AbsolutePath"/>
    </ConvertToAbsolutePath>
    <Message Text="$(AbsolutePath)"/>
    <Message Text="$([System.IO.Path]::GetFullPath('$(RelativePath)'))"/>        
  </Target>
</Project>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文