【发布时间】:2013-11-26 17:08:14
【问题描述】:
我有一个基本的 linq 查询,我想将其放入 CSV 文件中。从 LinqPad 运行时,以下代码可以正常工作:
var phxTix = Companies
.Select (c => new {
Ticker = c.Ticker.Trim(),
FameTick = c.Coverage_Status.Trim()});
Util.WriteCsv(phxTix, @"c:\Temp\phxticks.csv");
但是当我从命令行运行以下 Powershell 脚本时出现错误:
$srcLoc = "c:\linqscripts\GetPhxTix.linq"
$destLoc = "c:\Temp\phxticks.csv"
lprun -lang=e -cxname=myDB -format=csv $srcLoc > $destLoc
我得到的错误是:
lprun : c:\Users\AppData\Local\Temp\LINQPad\_ibakcumi\query_bggevp.cs(35,36) : error CS1513: }
expected
At c:\PS\GetPhxTicksJob.ps1:4 char:1
+ lprun -lang=e -cxname=myDB $srcLoc > $destLoc
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (c:\Users\...513: } expected:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
c:\linqscripts\GetPhxTix.linq(31,3) : error CS1519: Invalid token ')' in class, struct, or
interface member declaration
c:\linqscripts\GetPhxTix.linq(33,1) : error CS1022: Type or namespace definition, or end-of-file expected
我做错了什么?或者我缺少什么来执行这个 cli 脚本?
【问题讨论】:
标签: c# powershell command-line linqpad