0

During the build process, some files are generated by the system (concatenated, minified and versionned assets).

As these files are created on the fly, they're not added to the project, so when I publish, visual studio don't copy them.

Is there a way to tell VS to copy all files inside a folder?

Simon Boudrias
  • 42,953
  • 16
  • 99
  • 134
  • 1
    you should go to publish tab on project properties page - then go to application files list - and tell VS to include necessary files into publishing – sqladmin Jul 04 '13 at 15:34
  • or maybe you can find answer in this topic http://stackoverflow.com/questions/2364644/visual-studio-2010-publish-minified-javascript-files-instead-of-the-original-on?rq=1 – sqladmin Jul 04 '13 at 15:40
  • @sqladmin I can't find the option ("application file list" or similar wording) you talk about (I'm on VS 2010). – Simon Boudrias Jul 04 '13 at 15:49
  • i got russian VS2010 so maybe i gave you wrong translation )) - it is first button in the group of four buttons at right side of the 'publish' tab in project properties – sqladmin Jul 04 '13 at 16:11
  • if project is web application - properties page is different from page for winforms application project - just look for option 'include all files from project folder' or something like that – sqladmin Jul 04 '13 at 16:23

1 Answers1

1

Been able to resolve the issue by manually editing the .csproj file and adding those lines:

<PropertyGroup>
    <CopyAllFilesToSingleFolderForPackageDependsOn>
    CustomCollectFiles;
    $(CopyAllFilesToSingleFolderForPackageDependsOn);
  </CopyAllFilesToSingleFolderForPackageDependsOn>
    <CopyAllFilesToSingleFolderForMsdeployDependsOn>
    CustomCollectFiles;
    $(CopyAllFilesToSingleFolderForPackageDependsOn);
  </CopyAllFilesToSingleFolderForMsdeployDependsOn>
  </PropertyGroup>
  <Target Name="CustomCollectFiles">
    <ItemGroup>
      <_CustomFiles Include="public\form\dist\*.js" />
      <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
        <DestinationRelativePath>public\form\dist\%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
  </Target>
</PropertyGroup>
Simon Boudrias
  • 42,953
  • 16
  • 99
  • 134