6

我目前有以下脚本作为项目的后期构建:

if $(ConfigurationName) == "Debug (x64)" || $(ConfigurationName) == "Release (x64)" (goto :x64)
if $(ConfigurationName) == "Debug" || $(ConfigurationName) == "Release" (goto :x86)

:x64
copy "$(SolutionDir)References\x64\System.Data.SQLite.dll" "$(TargetDir)System.Data.SQLite.dll"
goto :default

:x86
copy "$(SolutionDir)References\System.Data.SQLite.dll" "$(TargetDir)System.Data.SQLite.dll"
goto :default

:default
copy "$(SolutionDir)References\System.Data.SQLite.Linq.dll" "$(TargetDir)System.Data.SQLite.Linq.dll"

(它根据配置将程序集的 x86 或 x64 版本复制到输出文件夹)

此脚本返回错误级别 255,由于我不知道批处理脚本,有人可以指出错误吗?

4

2 回答 2

10

在 cmd.exe 中,键入net helpmsg 255

扩展属性不一致。

我不知道这是否是实际错误,但它是破译 Win32 错误代码的便捷方法。

于 2010-10-12T22:28:30.520 回答
5

据我所知, IF批处理文件不支持将多个表达式组合在一起的类似 C 的语法。

因此,作为第一次尝试,将脚本的这些第一行从以下位置更改:

if $(ConfigurationName) == "Debug (x64)" || $(ConfigurationName) == "Release (x64)" (goto :x64)
if $(ConfigurationName) == "Debug" || $(ConfigurationName) == "Release" (goto :x86)

至:

if "$(ConfigurationName)"=="Debug (x64)" goto :x64
if "$(ConfigurationName)"=="Release (x64)" goto :x64
if "$(ConfigurationName)"=="Debug" goto :x86
if "$(ConfigurationName)"=="Release" goto :x86

还要注意"$(ConfigurationName).
其余的应该可以正常工作。

于 2010-10-12T22:43:02.453 回答