当你运行csi.exe /?(安装了Visual Studio 2015更新2),您将获得以下语法
Microsoft (R) Visual C# Interactive Compiler version 1.2.0.51106
Copyright (C) Microsoft Corporation. All rights reserved.
Usage: csi [option] ... [script-file.csx] [script-argument] ...
Run Code Online (Sandbox Code Playgroud)
我只是想知道如何将这个[ script-argument ] 传递给我的csx脚本文件.比方说,我的csx脚本(c:\ temp\a.csx)只有2行,如下所示
using System;
Console.WriteLine("Hello {0} !", <argument_from_commandLine>);
Run Code Online (Sandbox Code Playgroud)
我期望的是在运行以下命令行之后
csi.exe c:\temp\a.csx David
Run Code Online (Sandbox Code Playgroud)
我会得到
Hello David !
Run Code Online (Sandbox Code Playgroud)
但我只是不知道我应该在我的脚本文件中做什么,所以我可以将csi.exe [ script_argument ] 传递给我的脚本文件(替换).
在此先感谢您的时间和帮助.
我正在编写 .csx 构建脚本。在我的本地机器上,我从 Visual Studio 或通过C:\Program Files (x86)\MSBuild\14.0\bin\csi.exe. 我试过在 TeamCity 构建代理机器上运行 .csx 脚本(代理机器执行实际的构建任务,比如编译),它安装了 Microsoft Built Tools 2015。令人惊讶的是,csi.exeMSBuild 文件夹中没有。
我正在寻找一种csi.exe在我的构建代理机器上安装或兼容的独立 .csx 运行程序的方法。在 Google 中找到的选项,如https://github.com/cake-build/cake,似乎都有自己独特的脚本风格或许多附加功能,而我正在寻找csi.exe理想的克隆。
我每天都使用 F# Interactive,因此我喜欢从 cmd 启动它,而不仅仅是 Visual Studio 和 Visual Studio Code。为此,我FSHARPINSTALLDIR在 my 中调用了一个PATH指向C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\FSharp. 这使我只需键入即可fsi启动 F# 交互。
C# Interactive 安装在哪里,以便我可以做同样的事情?
我正在使用csi.exeC# 交互式编译器来运行.csx脚本。如何访问提供给我的脚本的任何命令行参数?
csi script.csx 2000
Run Code Online (Sandbox Code Playgroud)
如果您不熟悉 csi.exe,以下是使用信息:
>csi /?
Microsoft (R) Visual C# Interactive Compiler version 1.3.1.60616
Copyright (C) Microsoft Corporation. All rights reserved.
Usage: csi [option] ... [script-file.csx] [script-argument] ...
Executes script-file.csx if specified, otherwise launches an interactive REPL (Read Eval Print Loop).
Run Code Online (Sandbox Code Playgroud) 在 C# 交互式(作为 Visual Studio 2019 或独立的一部分)中,我想使用 C# 编写类似的代码:
var s = "abcdef";
var s1 = s[2..4];
Run Code Online (Sandbox Code Playgroud)
这给出了以下消息:
(1,12): 错误 CS0518: 未定义或导入预定义类型“System.Range”
有没有办法修改例如 csi.exe.config 或其他方式以支持 C# 8.0 ?
通过使用https://learn.microsoft.com/en-us/azure/aks/csi-secrets-store-nginx-tls本文档的参考,我尝试将 TLS 机密从 AKV 获取到 AKS pod。最初,我使用用户分配的托管身份创建并配置了CSI 驱动程序配置。
我已执行以下步骤:
apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
name: azure-tls
spec:
provider: azure
secretObjects: # secretObjects defines the desired state of synced K8s secret objects
- secretName: ingress-tls-csi
type: kubernetes.io/tls
data:
- …Run Code Online (Sandbox Code Playgroud) 我正在使用 Visual Studio 2015 Update 2。根据csi.exe有“C# 脚本文件”之类的内容:
如果指定则执行script-file.csx
有这种格式的文档吗?如何在 Visual Studio 中创建它们?
> csi.exe /?
Microsoft (R) Visual C# Interactive Compiler version 1.2.0.60317
Copyright (C) Microsoft Corporation. All rights reserved.
Usage: csi [option] ... [script-file.csx] [script-argument] ...
Executes script-file.csx if specified, otherwise launches an interactive REPL (Read Eval Print Loop).
Options:
/help Display this usage message (alternative form: /?)
/i Drop to REPL after executing the specified script.
/r:<file> Reference metadata from the specified assembly file (alternative …Run Code Online (Sandbox Code Playgroud) 运行csi.exe时看到以下错误:
System.BadImageFormatException:无法加载文件或程序集“ xyz.dll”或其依赖项之一。不是有效的Win32应用程序。(来自HRESULT的异常:0x800700C1)
在Visual Studio中进行编译会发出警告,但编译并运行不会出现问题:
正在构建的项目“ MSIL”的处理器体系结构与引用“ xyz”,“ x86”的处理器体系结构之间不匹配。这种不匹配可能会导致运行时失败。请考虑通过Configuration Manager更改项目的目标处理器体系结构,以使项目和引用之间的处理器体系结构保持一致,或者依赖具有与项目目标处理器体系结构相匹配的处理器体系结构的引用来进行依赖。
所以看来我在运行csi.exe时必须指定处理器体系结构?怎么做?