Azure DevOps Build publish does not include extra files

1.7k Views Asked by At

We have requirement to include extra files which are not included in the project because they are generated by webpack by different frontend project.

I have followed this article (https://tedgustaf.com/blog/2011/customize-an-aspnet-project-to-control-which-files-are-included-when-publishing-or-deploying/) and it works fine locally on VS 2019 when i publish but it does not work Azure DevOps Build.

Can someone please advise what i am missing ?

Update - 05/11/19

The below is folder structure of my source code

SolutionName
.... WebSite
.... FrontEnd
.... DataAccess

The "npm build prod" we run webpack and generate minified css and js in FrontEnd project and copy this to dist folder in WebSite and also copy additional scss files to website project.

webpack copy files code snippets

new CopyWebpackPlugin([
  { from: 'assets/images', to: 'assets/images' },
  { from: 'assets/icons', to: 'assets/icons' },
  { from: 'src/sass', to: '../theme-src/sass' }, 
  { from: 'node_modules/bootstrap/scss', to: '../node_modules/bootstrap/scss' }, 
  { from: 'node_modules/font-awesome/scss', to: '../node_modules/font-awesome/scss' },
  { from: 'node_modules/font-awesome/fonts', to: '../node_modules/font-awesome/fonts' }, 

Website.csproj copy files for publishing.

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

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

  <Target Name="CustomCollectFiles">

    <!-- Copy minified JavaScript & Css files -->
    <ItemGroup>
      <DistFolderFiles Include="dist\**\*.*" />
      <FilesForPackagingFromProject Include="%(DistFolderFiles.Identity)">
        <DestinationRelativePath>dist\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>

    <!-- Copy Sass files for themeing -->
    <ItemGroup>
      <ThemeSrcFolderFiles Include="theme-src\**\*.*" />
      <FilesForPackagingFromProject Include="%(ThemeSrcFolderFiles.Identity)">
        <DestinationRelativePath>theme-src\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>

    <!-- Copy Sass files for themeing dependency -->
    <ItemGroup>
      <NodeModulesFolderFiles Include="node_modules\**\*.*" />
      <FilesForPackagingFromProject Include="%(NodeModulesFolderFiles.Identity)">
        <DestinationRelativePath>node_modules\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>

  </Target>

enter image description here

0

There are 0 best solutions below