简体   繁体   English

创建dll时找不到依赖项

[英]Cannot find dependencies while creating dll

I try to create a dll from all of my classes with VS command prompt but all classes using externall dll's won't do. 我尝试使用VS命令提示符从我所有的类创建一个dll,但是使用externall dll的所有类都不会创建。

The program uses some dlls from OpenGl that I stored in the bin folder and it works fine while running the program 该程序使用了我存储在bin文件夹中的一些来自OpenGl的dll,并且在运行该程序时可以正常工作

But I get error CS0246, namespace could not be found, missing directive when I try to create a dll from all those classes. 但是我收到错误CS0246,找不到命名空间,当我尝试从所有这些类创建dll时缺少指令。

The line I use is: 我使用的行是:

csc /target:library /out:Engine.DLL *

All System namespace are found but all external dlls are not. 找到所有系统名称空间,但找不到所有外部dll。

Do I need to add a path to the external dlls in VS environment? 我是否需要在VS环境中添加到外部dll的路径?

You certainly need to use the /reference (or /r ) compiler option for your external assemblies ( here is the official documentation from msdn): 您当然需要为外部程序集使用/reference (或/r )编译器选项( 是msdn的官方文档):

csc /target:library /r:Assembly1.dll;Assembly2.dll out/Engine.DLL *

/lib could also be useful if your external assemblies are located in different folders and if you don't want to use /r with a full path (like /r:../test/folder/subfolder/Assembly1.dll ) 如果您的外部程序集位于不同的文件夹中,并且您不想将/r与完整路径一起使用(例如/r:../test/folder/subfolder/Assembly1.dll ),那么/ lib也可能很有用。

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

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