专用bin路径中的Visual Studio程序包的生成和DLL

问题描述

|| 我正在使用MEF进行某种粗略的插件体系结构。这运作良好。但是,当我使用Visual Studio打包/发布构建任务进行部署时(通过NAnt / MSbuild调用)。我未引用的插件程序集未包含在软件包中,因此未部署。 有没有办法告诉VS / MSBuild包含这些DLL? 他们住在/ bin / Extensions中。 干杯, 抢     

解决方法

         在程序集中将其添加为链接,并在其中复制它们:在项目上右击->添加->现有项->选择程序集。除了单击添加之外,还单击其旁边的箭头并选择\“添加为链接\” 如果未打开,请在解决方案资源管理器中选择链接的程序集->打开属性: 建立动作:无 复制到输出目录:始终复制或更新则复制 通过执行上述操作,程序集实际上仍是您最初拥有它们的位置(我假设是一个引用文件夹),并且在构建时,这些程序集将复制到bin文件夹中。     ,        我在此博客文章中找到了答案。它完美地工作:http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageInIncludeExtraFilesOrExclusionSpecificFiles.aspx 基本上,这是我添加到项目文件中的代码。
<!--
    Added by RSL to deal with deploying the plugins folder
    Followed tutorial here:
    http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx
  -->
    <PropertyGroup>
        <CopyAllFilesToSingleFolderForPackageDependsOn>
            CollectExtensionDLLs;
            CollectExtensionViews;
            $(CopyAllFilesToSingleFolderForPackageDependsOn);
        </CopyAllFilesToSingleFolderForPackageDependsOn>
    </PropertyGroup>
    <Target Name=\"CollectExtensionDLLs\">
        <ItemGroup>
            <_CustomFiles Include=\"bin\\Extensions\\**\\*\"/>

            <FilesForPackagingFromProject Include=\"%(_CustomFiles.Identity)\">
                <DestinationRelativePath>bin\\Extensions\\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
            </FilesForPackagingFromProject>
        </ItemGroup>
    </Target>
    <Target Name=\"CollectExtensionViews\">
        <ItemGroup>
            <_CustomFiles Include=\"Views\\Extensions\\**\\*\"/>

            <FilesForPackagingFromProject Include=\"%(_CustomFiles.Identity)\">
                <DestinationRelativePath>Views\\Extensions\\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
            </FilesForPackagingFromProject>
        </ItemGroup>
    </Target>
    <!-- //// End Rob\'s modifications -->
    ,        在此处查看此答案的一种方法:Team Build 2010-第三方程序集引用未复制到输出文件夹