简体   繁体   English

在没有单独的dll的情况下引用其他项目

[英]Reference other project in solution without separate dll

At the moment I have added and referenced another project to my main solution. 目前,我已经在主要解决方案中添加并引用了另一个项目。 It works, but then I need the separate dll that is compiled. 它可以工作,但随后我需要编译的单独的dll。

How can I reference another project without the need for a separate dll that I have to distribute with my final exe? 我如何可以引用另一个项目,而无需使用必须随最终exe分发的单独的dll?

AC# class project in a Visual Studio solution always compiles to an assembly, so adding a project reference will inevitably mean that your executable references the assembly built as a result of compiling the other project. Visual Studio解决方案中的AC#类项目始终会编译为程序集,因此添加项目引用将不可避免地意味着您的可执行文件将引用由于编译另一个项目而生成的程序集。 If you don't want to distribute the separate assembly with your executable the only thing you can do is to ILMERGE the assembly into your executable as a part of your deployment build process, 如果您不希望将单独的程序集与可执行文件一起分发,那么您唯一可以做的就是在部署构建过程中将程序集整合到可执行文件中,

You can't. 你不能。 The way .net works is to load an additional assembly and using its meta data the classes inside that. .net的工作方式是加载附加程序集,并使用其元数据将其中的类加载到其中。 If you are attempting to have a set of classes that you refer to by source similar to the way c++ uses header files you will have to import those files into your project. 如果您尝试使用类似于c ++使用头文件的方式引用的一组类,则必须将这些文件导入到项目中。

This sounds like you're trying to statically compile a library. 听起来您正在尝试静态编译库。 This is not (easily) offered by .NET without manually creating and merging assemblies. 如果没有手动创建和合并程序集,.NET不会(轻松)提供此功能。

暂无
暂无

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

相关问题 如何在单独的项目中调用或调用DLL方法而不在解决方案资源管理器中将其声明为参考? - How do you call or invoke a DLL method from a separate project without declaring it as a reference in the solution explorer? 如何创建一个dll以在单独的项目中引用和使用? - how to create a dll to reference and use in a separate project? 如何在同一解决方案中从其他项目的dll中调用方法 - How to call a Method from an dll from an other project in the same solution 设置解决方案中其他项目引用的dll类库的位置 - set location of dll class library which is referenced in other project in solution 在单独的解决方案中调试引用的DLL - Debug a referenced DLL in a separate solution 在不重新编译项目的情况下升级C#项目中的引用dll - Upgrade a reference dll in a C# project without recompiling the project 如何为几个类创建dll而无需创建单独的项目文件 - How to create a dll for a few classes without creating separate project file VS 2010 Visual C# - 在同一解决方案中引用其他项目 - VS 2010 Visual C# - reference other project in same solution 如何从其他解决方案引用ac#类库项目(不是dll) - How to reference a c# class library project(not dll) from a different solution 原生dll调用一直在我的解决方案中崩溃一个项目而不是另一个项目(Windows 7 64位) - A native dll call consistently crashes one project in my solution but not the other (windows 7 64 bit)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM