简体   繁体   English

构建项目的组件以拥有.dll

[英]Build project's components to own .dlls

I have project, which contains lot of classes. 我有一个项目,其中包含很多类。 I use this project as plugin base for one of my application. 我将此项目用作我的一个应用程序的插件基础。 This app can load all these plugins from one .dll builded from this project. 这个应用程式可以从这个专案建立的.dll载入所有这些外挂程式。

Problem is, I need to use these plugins in third-side app. 问题是,我需要在第三方应用程序中使用这些插件。 This app can load only one plugin per .dll. 该应用程序每个.dll只能加载一个插件。 I have very few options here. 我这里的选择很少。 As far as I know, I could create new project for each file and build them. 据我所知,我可以为每个文件创建一个新项目并进行构建。 But it is sloppy way how to solve it. 但这是草率的解决方法。

So, is there any way, how to build one project for each of its classes or for groups of classes? 那么,有什么方法可以为每个类或每个类组构建一个项目?

It sounds to me as task for some script. 在我看来,这是一些脚本的任务。 Is possible to achieve this for example with psake or powershell? 可以使用psake或powershell实现此目的吗?

Thanks in regards 谢谢问候

Well, I believe that they are already doing that in their own bin directories. 好吧,我相信他们已经在自己的bin目录中这样做了。 That`s if you mean assemblies as components. 那就是如果您将程序集作为组件。 If you are talking about classes, then you should place them in separate assemblies and use the same approach. 如果要讨论类,则应将它们放在单独的程序集中,并使用相同的方法。

You can right click on assembly and go to properties, build where you can see the 'output path' field as well as 'XML documentation' checkbox which is required for third-side apps to see your XML comments while using .dll-s. 您可以右键单击程序集并转到属性,在此处可以看到“输出路径”字段以及“ XML文档”复选框的位置,这是第三方应用程序在使用.dll-s时查看XML注释所必需的。

One way I can think of is to create a 'template' project file based on the Plugin project you already have. 我能想到的一种方法是根据您已有的Plugin项目创建一个“模板”项目文件。 You can make a copy of the plugin.csproj and then delete all included plugin classes. 您可以复制plugin.csproj ,然后删除所有包含的插件类。 Using psake and Powershell you can dynamically add the plugin class you need an assembly for and then call MSBuild to build the csproj. 使用psake和Powershell,可以动态添加所需的程序集所需的插件类,然后调用MSBuild来构建csproj。

 <ItemGroup>
    <Compile Include="MyFirstPlugin.cs" />
 </ItemGroup>

Adding xml-nodes like this to an csproj-file is easy to do in Powershell. 在Powershell中很容易将这样的xml节点添加到csproj文件中。

The pseudo code for the ps script could be something like this; ps脚本的伪代码可能是这样的。

define list of plugin cs-files 
for each plugin cs file   
    copy template.csproj to plugin.csproj
    add xml node to include plugin.cs file
    call msbuild on plugin.csproj
    delete plugin.csproj file

暂无
暂无

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

相关问题 发布ASP .NET Web项目后项目的dll丢失 - Project`s dlls missing after publish asp .net web project 构建Visual Studio项目而无需访问引用的dll - Build a Visual Studio Project without access to referenced dlls 引用的DLL驻留在项目的\\ bin \\ Debug文件夹中是否可以接受? - Is it Acceptable for Referenced DLLs to reside in the project's \bin\Debug folder? 类型存在于错误共享项目引用中,并在构建时为每个项目提供它自己的库的 DLL 构建 - Type exists in both error sharing project references and giving each project it's own DLL build of a library when building 项目引用另一个项目的obj文件夹中的dll-有时有时不编译 - Project refers to dlls in another project's obj folder - compiles sometimes other times not 将ac#项目构建为两个具有不同程序集名称和guid的相同dll - build a c# project into two identical dlls with different assembly names and guids 我可以在Visual Studio 2008中从C#项目构建2个或更多dll吗? - Can I build 2 or more dlls from C# project in Visual Studio 2008? 复制C ++ dll以生成任何通过扩展引用它们的C#项目的输出 - Copy C++ dlls to build output of any C# project that reference them by extension 配置MSBuild以构建解决方案,并为每个项目将构建的dll放入一个目录,将外部库放入另一个目录 - Configure MSBuild to build a solution and for each project put the built dlls into one directory and external libraries into another 启动WPF项目。 建立自己的控件还是购买? - Starting WPF project. Build own controls or buy?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM