Cygwin 1.7.x 无法将 Windows 路径转换为 POSIX 路径
大约一年后,我修改了我的一个项目,在安装程序文件名中包含 subversion 修订版。 我安装了 MSBuild.Community.Tasks.Targets 并修改了 csproj 文件,使其包含:
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
...
<SvnVersion LocalPath="$(MSBuildProjectDirectory)" ToolPath="C:\cygwin\bin">
<Output TaskParameter="Revision" PropertyName="Revision" />
</SvnVersion>
...
这就像一个魅力。但是,升级到 cygwin 1.7 后,运行构建过程时开始出现以下错误:
C:\cygwin\bin\svnversion.exe --无换行符 “Z:/cygdrive/z/dev/myproject/src/winservice”
'/cygdrive/z/dev/myproject/src/winservice/Z:/cygdrive/z/dev/myproject/src/winservice' 不存在
Z:\dev\swiftarhiv\src\myproject\myprojectservice.csproj(200,5):错误 MSB6006:“svnversion.exe”退出,代码为 1。完成构建项目
“Z:\dev\swiftarhiv\src\myprojects\myprojectservice.cspro j”(重建 目标)——失败。
我尝试将 SvnInfo 任务的 LocalPath 参数修改为“。”或“/cygdrive/z/dev/myproject/src/winservice”,但是SvnInfo任务有一个讨厌的习惯,无论你在“.”中输入什么内容,都会使用Windows完整路径。解析为之前使用的路径,“/cygdrive/z/dev/myproject/src/winservice”解析为“Z:/cygdrive/z/dev/myproject/src/winservice”,这再次导致错误。
我可以在 Cygwin 1.7 中设置一个设置来减少我的问题吗?
Year or so hence, I modified a project of mine to include subversion revision in installer file name.
I installed MSBuild.Community.Tasks.Targets and modified csproj file so that it contained:
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
...
<SvnVersion LocalPath="$(MSBuildProjectDirectory)" ToolPath="C:\cygwin\bin">
<Output TaskParameter="Revision" PropertyName="Revision" />
</SvnVersion>
...
This worked like a charm. However, after upgrade to cygwin 1.7, following error started to occur when running build process:
C:\cygwin\bin\svnversion.exe --no-newline
"Z:/cygdrive/z/dev/myproject/src/winservice"'/cygdrive/z/dev/myproject/src/winservice/Z:/cygdrive/z/dev/myproject/src/winservice'
doesn't existZ:\dev\swiftarhiv\src\myproject\myprojectservice.csproj(200,5): error
MSB6006 : "svnversion.exe" exited with code 1. Done Building Project"Z:\dev\swiftarhiv\src\myprojects\myprojectservice.cspro j" (Rebuild
target(s)) -- FAILED.
I tried modifying LocalPath parameter of SvnInfo task to "." or "/cygdrive/z/dev/myproject/src/winservice", but SvnInfo task has a nasty habit of using windows full path no matter what you put in so "." resolved to the path used before and "/cygdrive/z/dev/myproject/src/winservice" resolved to "Z:/cygdrive/z/dev/myproject/src/winservice" which caused an error again.
Is there a setting I can set in Cygwin 1.7 that will make my problems scarce?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您希望能够有意使用特定的路径格式,可以使用 cygpath 实用程序。
在不了解 Subversion 构建过程的详细信息的情况下,您是否可以通过传递 MSBuildProjectDirectory 对象来设置 LocalPath?
If you want to be able to deliberately use a particular path format, you could use the
cygpath
utility.Without knowing the particulars of the Subversion build process, would it be possible for you to set the LocalPath by passing that MSBuildProjectDirectory object through it?