我创建了以下响应文件(我正在关注本文中的示例:Working with the C# 2.0 Command Line Compiler):
# MyCodeLibraryArgs.rsp
#
# These are the options used
# to compile MyCodeLibrary.dll
# Output target and name.
/t:library
/out:MyCodeLibrary.dll
# Location of C# files.
/recurse:*.cs
# Give me an XML doc.
/doc:myDoc.xml
然后我尝试使用 PowerShell 中的 C# 编译器 (csc.exe) 执行它:
csc @MyCodeLibraryArgs.rsp
然后它会生成以下错误:
Cannot expand the splatted variable '@MyCodeLibraryArgs'. Splatted variables
cannot be used as part of a property or array expression. Assign the result of
the expression to a temporary variable then splat the temporary variable instead.
At line:1 char:23 + csc @MyCodeLibraryArgs <<<< .rsp
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : NoPropertiesInSplatting
所以,我决定使用提示符(命令行),它工作正常。
PowerShell (v.3.0) 出现此问题的原因是什么?
提前感谢您的回复和评论。