Visual Studio 包构建和私有 bin 路径中的 DLL

发布于 2024-11-09 19:18:40 字数 198 浏览 1 评论 0原文

我正在使用 MEF 来做一种粗略的插件架构。这运作良好。但是,当我使用 Visual Studio 包/发布构建任务(我通过 NAnt/MSbuild 调用)进行部署时。我未引用的插件程序集未包含在包中,因此未部署。

有没有办法告诉 VS/MSBuild 包含这些 DLL?

他们住在 /bin/Extensions 中。

干杯, 抢

I am using MEF to do a sort of crude plugin architecture. This is working well. However, when I do a deployment using the visual studio package/publish build tasks (which I am calling via NAnt/MSbuild). My unreferenced plugin assemblies are not being included in the package and so are not deployed.

Is there a way to tell VS/MSBuild to include these DLLs?

They live in /bin/Extensions.

Cheers,
Rob

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

白况 2024-11-16 19:18:40
  • 将程序集作为链接添加到要复制的项目中:右键单击项目 ->添加->现有项目 ->选择装配体。不要只单击“添加”,而是单击旁边的箭头并选择“添加为链接”
  • 在解决方案资源管理器中选择链接的程序集 ->如果未打开,则打开属性:
    • 构建操作:无
    • 复制到输出目录:始终复制或较新时复制
    • 构建

通过执行上述操作,程序集仍然物理地位于您最初拥有它们的位置(我假设是引用文件夹),并且当您构建时,它们被复制到垃圾箱文件夹。

  • Add the assemblies as links in the project where you want them copied: right lick on the project -> Add -> Existing Item -> select the assembly. Instead of just clicking Add, click on the arrow besides it and select "Add As Link"
  • Select the linked assembly in the solution explorer -> open properties if it isn't opened:
    • Build Action: None
    • Copy to Output Directory: Copy always or Copy if newer

By doing the above the assemblies are still physically where you had them originally (I assume a references folder) and when you build those are copied to the bin folder.

如果没结果 2024-11-16 19:18:40

我在这篇博文中找到了答案。它工作完美: http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageInducingExtraFilesOrExducingSpecificFiles.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 -->

I have found the answer in this blog post. It works perfectly: http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx

Basically here's the code I added to my project file.

<!--
    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 -->
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文