Writing Text Files in Rhino with C#

Hi everyone,

I am trying to write a text file in Rhino. Afterwards I want to run an external program with that file.

var text = new List<string> {"first line", "second line", "third line"}; System.IO.File.WriteAllLines("test.txt", text); Process.Start("program.exe", "test.txt");

This sequence runs perfectly in the debug mode in Visual Studio. But if I try the command in the release version it does not work.

Here is an entire exmaple that shows what I want to do:
public class CommandWriteTextFile : Command { static CommandWriteTextFile _instance; public CommandWriteTextFile() { _instance = this; }
public static CommandWriteTextFile Instance => _instance;

public override string EnglishName => "WriteTextFile";

protected override Result RunCommand(RhinoDoc doc, RunMode mode) { var text = new List<string> {"first line", "second line", "third line"}; System.IO.File.WriteAllLines("test.txt", text); Process.Start("carat.exe", "test.txt"); return Result.Success; } }

What am I doing wrong here?
Thanks for your help!
Tobi

Perhaps you need to provide the full path to the file you are writing?

Thanks for your help, now it works!