2019-12-03 Visual Studio 2017 Website launched additional dll

1. Problem:

    MySQL Connector registered dll project reference data connection (MySQL.Data.DLL) in the .net Framework. Therefore, when you build and will not release a copy of DLL

To publish folders, each release led to the need to manually copy the DLL to publish folders bin directory.

 

2. Solution

    -. A unloading site project .csproj, right-click Edit csproj

    - b at the end .csproj.

  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />

      Add PropertyGroup node after node

  <PropertyGroup>
    <CopyAllFilesToSingleFolderForPackageDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForPackageDependsOn>
  </PropertyGroup>

    And Target node

  <Target Name="CustomCollectFiles">
    <ItemGroup>
      <_CustomFiles Include="..\Extra Files\**\*" />
      <FilesForPackagingFromProject  Include="%(_CustomFiles.Identity)">
        <DestinationRelativePath>bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
  </Target>

    -. C reload the project and the establishment of "Extra Files" folder in the project folder level, will be required to copy the dll to the bin directory into which

 

FIG. 1. Extra Files file path schematically

 

Figure 2. Extra Files contains the desired release dll

    -. D then click Publish to publish the forthcoming MySql.Data.dll copy the folder bin directory

 

 Figure 3. Publish the results

 

 3. References

"http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx"

Guess you like

Origin www.cnblogs.com/hexx/p/11976826.html