Visual Studio Package build and DLLs in private bin path

前端 未结 3 1541
野趣味
野趣味 2021-01-03 14:24

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

相关标签:
3条回答
  • 2021-01-03 14:27
    • 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.

    0 讨论(0)
  • 2021-01-03 14:48

    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 -->
    
    0 讨论(0)
  • 2021-01-03 14:49

    Check out this answer here for one approach: Team Build 2010 - Third Party Assembly References not copying to output folder

    0 讨论(0)
提交回复
热议问题