简体   繁体   English

CSharp编译器无法打开父目录中的文件

[英]CSharp compiler can't open files in parent directory

I'm trying to compile a cs file that is in a sibling directory of my project but csc fails to open it. 我正在尝试编译项目的同级目录中的CS文件,但csc无法打开它。 Here's a sample of the command line that triggers the issue: 这是触发问题的命令行示例:

csc ../test/file.cs

Csc prints this message: Csc打印此消息:

error CS1504: Source file '<path to current dir>\file.cs' could not be openned

The really really strange thing is that it strips the "../test" part. 真正真正奇怪的是,它剥离了“ ../test”部分。

Anyone has an idea on how to make this work? 有人对如何进行这项工作有想法吗? thanks 谢谢

Since this is the command line, you should use backslashes to delimit the directories. 由于这是命令行,因此应使用反斜杠来分隔目录。

csc ..\test\file.cs

(In a C# program, it wouldn't matter if you'd use backslashes or forward slashes.) (在C#程序中,使用反斜杠还是正斜杠都没关系。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM