简体   繁体   English

CSC与MySQL的C#命令

[英]CSC with C# Command For MySQL

I am still learning c# and have been following a tutorial where I use Visual Studio to connect MySQL. 我仍在学习c#,并且一直在遵循使用Visual Studio连接MySQL的教程。 I want to compile the file using csc on the command line this time and error cs0246 came out6 where its ays "The type or namespace name 'MySqlConnection' could not be found (are you missing a using directive or assembly reference?)". 这次我想在命令行上使用csc编译文件,并且出现错误cs02466,在该错误中ays“找不到类型或名称空间名称'MySqlConnection'(您是否缺少using指令或程序集引用?)”。

I am just using the command "csc MyFile.cs". 我只是使用命令“ csc MyFile.cs”。 I know that I should be using some form of directive but I'm not sure how to use it? 我知道我应该使用某种形式的指令,但不确定如何使用它? In Visual Studio, all I have to do is add the MySql.Data and MySql.Data.Entity into the Reference under the project. 在Visual Studio中,我要做的就是将MySql.Data和MySql.Data.Entity添加到项目下的Reference中。 How do I use the csc command? 如何使用csc命令?

csc /? contains all answers... Also covered in Working with the C# 2.0 Command Line Compiler . 包含所有答案... 使用C#2.0命令行编译器中也进行了介绍

Will be something like (not sure what is the name/path of assembly you need to link): 会是这样的(不确定要链接的程序集的名称/路径是什么):

csc /reference:MySqlConnection.dll MyFile.cs

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

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