add extra files on deploy ASP Core web app using publish profile

So i have been struggling with this for a while now.
i used to be able to add file to my ASP .NET projects through publish profiles using the following customization


<!--Cutome entry to include custom DLLs-->
  <target name="CollectHelpers">
    <itemgroup>
      <_customfiles include="$(MSBuildProjectDirectory)\bin\Custom*.dll">
      <filesforpackagingfromproject include="%(_CustomFiles.Identity)">
        <destinationrelativepath>bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</filesforpackagingfromproject>
    </_customfiles>
  </target>
  <target name="CollectCustomizations">
    <itemgroup>
      <_customfiles include="$(MSBuildProjectDirectory)\bin\*Custom*.dll">
      <filesforpackagingfromproject include="%(_CustomFiles.Identity)">
        <destinationrelativepath>bin\%(RecursiveDir)%(Filename)%(Extension</DestinationRelativePath>
      </filesforpackagingfromproject>
    </_customfiles>
  </target>
  <propertygroup>
    <copyallfilestosinglefolderforpackagedependson>
      CollectHelpers;
      CollectCustomizations;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </copyallfilestosinglefolderforpackagedependson>

    <copyallfilestosinglefolderformsdeploydependson>
      CollectHelpers;
      CollectCustomizations;
      $(CopyAllFilesToSingleFolderForMsdeployDependsOn);
    </copyallfilestosinglefolderformsdeploydependson>
  </propertygroup>
  <!--End of Custom entry-->

that's mentioned here.

however as i am developing my own first mobile-first ERP WorkNxt which i am using .NET Core for this wasn't working at all.

i searched high and low for any information that might mention any thing when it come to ASP Core web application but couldn't find any.
until i found this on Microsoft, and this did work!

although it's not clear on the document above but you have to insert something like

<ItemGroup>
    <_CustomFiles Include="$(OutDir)*Module*.dll" />
    <DotnetPublishFiles Include="@(_CustomFiles)">
      <DestinationRelativePath>%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
    </DotnetPublishFiles>
 </ItemGroup>


just before </project> tag and you are done, now my web app deploy with the extra DLLs

Popular posts from this blog

how to copy NuGet packages from one project to another

How to load a DLL and runtime, invoke a method by name, get result object and use it as a parameter on another unkown DLL .NET Core

Blazor how to generate that SHA256 check