In Visual Studio 2015 ASP.NET MVC project I am using "File System" publish method for project publishing. Additionally I want to include custom JSON configuration file (settings_dev.conf) in publishing process. By default this file is not published to file system.
- Is it possible to include single file in publish profile configuration?
- Is it possible to change the name of published file? From "settings_dev.conf" to "settings.conf".
Below is the configuration which I have tried.
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Dev</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<DeleteExistingFiles>False</DeleteExistingFiles>
<CopyAllFilesToSingleFolderForPackageDependsOn>
Settings;
<!--$(CopyAllFilesToSingleFolderForPackageDependsOn);-->
</CopyAllFilesToSingleFolderForPackageDependsOn>
</PropertyGroup>
<Target Name="Settings">
<ItemGroup>
<_CustomFiles Include="$(MSBuildProjectDirectory)\settings_dev.conf" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>%(RecursiveDir)settings.conf</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
</Project>
Using this configuration all files get published. I have other settings.conf files for different environments.