简体   繁体   English

如何在没有项目的情况下编译C#文件?

[英]How to compile C# file without a project?

Is there a way in VS2013 to compile a C# file without a project or solution? 在VS2013中有没有办法在没有项目或解决方案的情况下编译C#文件?

This is useful, eg in editing some C# code quickly while preparing a Stack Overflow answer while scrubbing corporate IP from the file (without risking any harm to the "real project"). 这很有用,例如在准备Stack Overflow应答时快速编辑一些C#代码,同时从文件中清除公司IP(不会对“真实项目”造成任何损害)。

The build toolbar is grayed-out. 构建工具栏显示为灰色。

I know one can occasionally see squiggles for errors. 我知道偶尔可以看到错误的曲折。

Any other simple ideas? 还有其他简单的想法?

You can use https://dotnetfiddle.net/ 你可以使用https://dotnetfiddle.net/

You can specify different things in it. 您可以在其中指定不同的内容。 It is best for writing fast answers, also you can post link with your saved work. 最好是写快速答案,也可以发布与保存的工作的链接。 It is similar to jsfiddle if you aware of it. 如果你意识到它,它类似于jsfiddle。

You can use Snippet Compiler. 您可以使用Snippet Compiler。 You can download it from below URL. 您可以从以下URL下载它。

http://www.sliver.com/dotnet/SnippetCompiler/ http://www.sliver.com/dotnet/SnippetCompiler/

Its a stand alone light weight small application. 它是一个独立的轻量级小应用程序。

If you have Mono C# installed then C# REPL is awesome tool to execute small chunk of c# code. 如果安装了Mono C#,那么C#REPL是执行小块c#代码的绝佳工具。

http://www.mono-project.com/docs/tools+libraries/tools/repl/ http://www.mono-project.com/docs/tools+libraries/tools/repl/

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

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