简体   繁体   English

如何开始使用Cygwin进行C#开发?

[英]How do I get started using Cygwin for C# development?

I'm coming from Linux, and I want to try to learn some C# development. 我来自Linux,我想尝试学习一些C#开发。

But I'm partial to the command line and using Vim. 但我偏向命令行并使用Vim。 Is it easy to set up Cygwin to run the csc compiler from the command line and to edit C# files directly in the console with Vim? 是否可以轻松设置Cygwin从命令行运行csc编译器并使用Vim直接在控制台中编辑C#文件?

I downloaded SharpDevelop, but I would really like to give console-style C# development a try. 我下载了SharpDevelop,但我真的想尝试一下控制台式的C#开发。

Specifically, how do I set up the PATH (is there an equivalent to .bash_profile?) so that I can run csc and vim from the Windows Console? 具体来说,我如何设置PATH(是否相当于.bash_profile?),以便我可以从Windows控制台运行csc和vim?

I'm running Windows 7. 我正在运行Windows 7。

You should give VsVim a try. 你应该试试VsVim With C#, you'll thank yourself for sticking with Visual Studio. 使用C#,你会感谢你坚持使用Visual Studio。

Specifically, how do I set up the PATH (is there an equivalent to .bash_profile?) so that I can run csc and vim from the Windows Console? 具体来说,我如何设置PATH(是否相当于.bash_profile?),以便我可以从Windows控制台运行csc和vim?

Exactly like in linux. 完全像在Linux中。 The only difference, IIRC, is that you use .bashrc instead of .bash_profile . 唯一的区别是IIRC,你使用的是.bashrc而不是.bash_profile Edit (or create) the file in your cygwin user's home directory ( ~/ ) and write the usual export PATH=$PATH:/path/to/other/bin lines. cygwin用户的主目录( ~/ )中编辑(或创建)该文件,并编写通常的export PATH=$PATH:/path/to/other/bin行。

http://www.cygwin.com/cygwin-ug-net/setup-env.html http://www.cygwin.com/cygwin-ug-net/setup-env.html

I love VsVim, as suggested by Joel. 我喜欢VsVim,正如乔尔所建议的那样。 But you said you want to try without Visual Studio, so here: 但是你说你想在没有Visual Studio的情况下尝试,所以这里:

vim integrates well with gnu make , and writing makefiles for C# programs is quite simple. vim与gnu make很好地集成,为C#程序编写makefile非常简单。

Just be careful about tabs vs spaces, same as on Linux (and like I'm not doing on SO, since getting tabs in HTML code blocks is hard). 关注标签与空格,就像在Linux上一样(就像我在SO上做的那样,因为在HTML代码块中获取标签很难)。 You'll just need a rule along the lines of: 你只需要一条规则:

myapp.exe : mymain.cs myhelpers.cs mydialog.cs
    csc.exe /o /out:$@ $^

Then from inside vim , you can just use the :make command. 然后从vim内部,你可以使用:make命令。

        ProcessStartInfo pInfo = new ProcessStartInfo("C:\\Cygwin\\bin\\mintty.exe");
        pInfo.Arguments = "-i /Cygwin-Terminal.ico -";

if cygwin is installed on C:\\ 如果cygwin安装在C:\\

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

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