mysql - C#: Including assemblies without visual studio -
how include external assembly .dll in c# .exe? i'm working mysql connectors .net 4.0.
please note, i'm not using visual studio @ time , not plan in order accomplish this. here's error when compile: cs0246: type or namespace mysql not found (are missing using directive or assembly reference?)
i have tried: - copying .dlls source folder project. - copying .dlls .net folder under windows
the first 3 lines of code are:
using system; using mysql; using mysql.data;
sample program (program.cs)
using system; using mysql.data.mysqlclient; namespace testapp { internal class program { private static void main(string [] args) { console.writeline("hello world!"); var command = new mysqlcommand(); console.writeline(command.tostring()); } } } project file (testapp.csproj)
<project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <itemgroup> <compile include="program.cs" /> </itemgroup> <target name="build"> <csc sources="@(compile)" additionallibpaths="lib" references="mysql.data.dll"> </csc> </target> </project> mysql.data.dll in folder named lib run msbuild command line
msbuild testapp.csproj /t:build microsoft's guide writing own msbuild files. https://msdn.microsoft.com/en-us/library/dd576348.aspx
csc task details https://msdn.microsoft.com/en-us/library/s5c8athz.aspx
Comments
Post a Comment