Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么PowerShell没有';理解';响应文件的说明?_C#_.net_Powershell - Fatal编程技术网

C# 为什么PowerShell没有';理解';响应文件的说明?

C# 为什么PowerShell没有';理解';响应文件的说明?,c#,.net,powershell,C#,.net,Powershell,我已经创建了以下响应文件(我遵循本文中的示例:): 然后我尝试使用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 r

我已经创建了以下响应文件(我遵循本文中的示例:):

然后我尝试使用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
无法展开飞溅的变量'@MyCodeLibraryArgs'。飞溅变量
不能用作属性或数组表达式的一部分。分配结果
将表达式转换为临时变量,然后将临时变量替换为splat。

第1行char:23+csc@MyCodeLibraryArgs@是powershell中用于“splatting”变量的特殊语法。你想逃离“像这样”的世界吗

 csc `@MyCodeLibraryArgs.rsp
Splatting允许您在哈希表中传递cmdlet参数。如果您想动态地构建正在传递的参数,这是很方便的。如果有很多论据,它也可以更具可读性。更多关于飞溅的信息

 csc `@MyCodeLibraryArgs.rsp