2

I have a ASP.net MVC 4 web application and web.config is referencing some other external config files (e.g. ). When publishing the website only web.config gets published and none of these external files will be deployed.

Note: I have set properties of these external config file as: BuildAction : Content, Copy always too but didn't change anything!

Has anybody come up with a solution for this?

Thanks

Kevin
  • 61
  • 6
  • Do you need something like this? http://stackoverflow.com/questions/2747081/how-do-you-include-additional-files-using-vs2010-web-deployment-packages – Matt Aug 09 '13 at 21:28
  • @matt that's it. Voting to close as dupe. If you want to compose your own version of the correct answer I'll throw you the bounty, as you had the correct answer first. –  Aug 11 '13 at 15:41

1 Answers1

0

Modify your project file as such:

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

  <CopyAllFilesToSingleFolderForMsdeployDependsOn>
    CustomConfigFiles;
    $(CopyAllFilesToSingleFolderForPackageDependsOn);
  </CopyAllFilesToSingleFolderForMsdeployDependsOn>
</PropertyGroup>

<Target Name="CustomConfigFiles">
  <ItemGroup>
    <YourCustomConfigFiles Include="..\Path\To\Your\**\*.config" />

    <FilesForPackagingFromProject  Include="%(YourCustomConfigFiles)">
      <DestinationRelativePath>Target\Path\For\Your\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
    </FilesForPackagingFromProject>
  </ItemGroup>
</Target>

based on this answer

Community
  • 1
  • 1
rene
  • 41,474
  • 78
  • 114
  • 152
  • More like *copied from this answer* :/ But at least the correct answered dupe has been located. –  Aug 11 '13 at 15:40