如何在使用 visual studio 的 Exec 中避免代码为 -1 的错误 MSB3073,同时仍然使用 sysnative 虚拟文件夹
How can I avoid error MSB3073 with code -1 from Exec with visual studio while still using sysnative virtual folder
这是我之前提问的 的后续。简而言之,我 运行 来自 visual studio 的 64 位版本的 cmd(这是 32 位应用程序)。我这样做是因为我需要 运行 一个只能从 64 位版本的 cmd 访问的命令 oscdimg.exe。
<Target Name="AfterBuild">
<Exec Command="%windir%\sysnative\cmd.exe /c "$(ProjectDir)test.bat UPLOAD"" WorkingDirectory="$(ProjectDir)" />
</Target>
虽然这一切正常,但我收到以下错误。
错误 MSB3073:命令“%windir%\sysnative\cmd.exe /c "C:\XXXX\XXX\XXX\test.bat UPLOAD"”已退出,代码为 -1。
虽然这个错误没有影响我的工作,这意味着批处理成功地执行了它的任务,但修复这个错误消息仍然很好,因为我团队中的其他人质疑这个错误消息。
我假设触发此错误是因为虽然 visual studio 是 32 位应用程序,但构建或执行程序调用可能是 64 位应用程序的 windows 操作系统应用程序。而 64 位应用程序看不到 sysnative virtual folder.
有什么办法可以解决这个错误吗?
编辑:向命令添加参数以模拟实际使用并显示我添加 "
.
的原因
我最近的一个惊喜是robocopy returns 1 when it finishes the copy successfully,作者@Valamas 显示为斜体
Confusion will set in when no files are copied = no error in VS. Then when there are changes, files do get copied, VS errors but everything the developer wanted was done.
当 robocopy 是批处理文件中的最后一个命令时,VS 会拾取此 return 值并将其解释为错误。
在 robocopy 的情况下,VS returns 1 而不是 -1 所以它与我现在的情况略有不同。但是,由于我的批处理文件按预期运行,一旦批处理完成且没有错误,我觉得足够安全 return 0。
exit 0
我再也看不到 MSB3073 了。
对于这个 post 的问题,由于 oscdimg 是我在批处理文件中的最后一个命令,我假设 oscdimg return 成功后的非零值。
我找不到关于 oscdimg 的支持文档。
这是我之前提问的
<Target Name="AfterBuild">
<Exec Command="%windir%\sysnative\cmd.exe /c "$(ProjectDir)test.bat UPLOAD"" WorkingDirectory="$(ProjectDir)" />
</Target>
虽然这一切正常,但我收到以下错误。
错误 MSB3073:命令“%windir%\sysnative\cmd.exe /c "C:\XXXX\XXX\XXX\test.bat UPLOAD"”已退出,代码为 -1。
虽然这个错误没有影响我的工作,这意味着批处理成功地执行了它的任务,但修复这个错误消息仍然很好,因为我团队中的其他人质疑这个错误消息。
我假设触发此错误是因为虽然 visual studio 是 32 位应用程序,但构建或执行程序调用可能是 64 位应用程序的 windows 操作系统应用程序。而 64 位应用程序看不到 sysnative virtual folder.
有什么办法可以解决这个错误吗?
编辑:向命令添加参数以模拟实际使用并显示我添加 "
.
我最近的一个惊喜是robocopy returns 1 when it finishes the copy successfully,作者@Valamas 显示为斜体
Confusion will set in when no files are copied = no error in VS. Then when there are changes, files do get copied, VS errors but everything the developer wanted was done.
当 robocopy 是批处理文件中的最后一个命令时,VS 会拾取此 return 值并将其解释为错误。
在 robocopy 的情况下,VS returns 1 而不是 -1 所以它与我现在的情况略有不同。但是,由于我的批处理文件按预期运行,一旦批处理完成且没有错误,我觉得足够安全 return 0。
exit 0
我再也看不到 MSB3073 了。
对于这个 post 的问题,由于 oscdimg 是我在批处理文件中的最后一个命令,我假设 oscdimg return 成功后的非零值。
我找不到关于 oscdimg 的支持文档。