构建后脚本返回errorlevel 255

Fem*_*ref 6 batch-file visual-studio-2010 post-build

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

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"
Run Code Online (Sandbox Code Playgroud)

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

这个脚本返回错误级别255,因为我不知道批处理脚本,有人能指出我的错误吗?

MSN*_*MSN 10

在cmd.exe中,键入net helpmsg 255:

扩展属性不一致.

我不知道这是否是实际错误,但它是解密Win32错误代码的一种方便方法.


Fra*_*ack 5

据我所知, IF批处理文件不支持将多个表达式ORing在一起的C语法.

因此,首先尝试更改脚本的第一行:

if $(ConfigurationName) == "Debug (x64)" || $(ConfigurationName) == "Release (x64)" (goto :x64)
if $(ConfigurationName) == "Debug" || $(ConfigurationName) == "Release" (goto :x86)
Run Code Online (Sandbox Code Playgroud)

至:

if "$(ConfigurationName)"=="Debug (x64)" goto :x64
if "$(ConfigurationName)"=="Release (x64)" goto :x64
if "$(ConfigurationName)"=="Debug" goto :x86
if "$(ConfigurationName)"=="Release" goto :x86
Run Code Online (Sandbox Code Playgroud)

还要注意附加"$(ConfigurationName).
其余应该工作正常.