我正在使用Visual Studio Code for Mac,运行扩展名CodeRunner。我有一个简单的程序:
using System;
namespace HelloWorldApplication {
class HelloWorld {
static void Main(string[] args) {
Console.WriteLine("hellowol");
}
}
}
Run Code Online (Sandbox Code Playgroud)
使用右上角的播放按钮运行它时,出现以下错误:
/bin/sh scriptcs: command not found
Run Code Online (Sandbox Code Playgroud)
然后
[Done] exited with code=127 in 0.008 seconds
Run Code Online (Sandbox Code Playgroud)
程序未显示所需的输出。
编辑:非常感谢@VonC。他的方法行得通。 任何人的专业提示:使用安装脚本
brew install scriptcs
Run Code Online (Sandbox Code Playgroud) 我尝试使用 Visual Studio 的 Coderunner 扩展以及使用 scriptcs 命令从终端运行我的程序。
我的代码如下:
using System;
namespace HelloWorldApplication {
class HelloWorld {
static void Main(string[] args) {
Console.WriteLine("hellowol");
}
}
}
Run Code Online (Sandbox Code Playgroud)
错误信息如下:
Unexpected named argument: Users/jfitz/Projects/C#/Projtest/test.cs
Run Code Online (Sandbox Code Playgroud) 我的应用程序 iOS 部分的 Resources 文件夹中有一个 .sqlite 文件。在 AppDelegate.cs 现在我有:
string dbname = "test.sqlite";
string folderPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Resources), "..", "Library");
string fullPath = Path.Combine(folderPath, dbname);
Run Code Online (Sandbox Code Playgroud)
我的问题是,当我使用 sqlite-net-pcl 库加载 sqlite 文件时,它显示一个空数据库,尽管 sqlite 文件中有超过 10,000 行。我认为问题是我链接到错误的东西。
同样,sqlite 文件位于 Resources 文件夹中。如何访问其文件路径?