You could do this with two publish profiles. It would involve skipping (with caveats if performing the deployment from within Visual Studio) the appropriate content for each profile.
However, I'd recommend doing a full deploy to your application server and then using the runCommand
provider to execute a batch file.
To do this, you could define the following in your publish profile:
<ItemGroup>
<AfterAddIisSettingAndFileContentsToSourceManifest>
$(AfterAddIisSettingAndFileContentsToSourceManifest);
AddContentDeploymentToSourceManifest;
</AfterAddIisSettingAndFileContentsToSourceManifest>
</ItemGroup>
<Target Name="AddContentDeploymentToSourceManifest">
<ItemGroup>
<MsDeploySourceManifest Include="runCommand">
<Path>$(MSBuildProjectDirectory)\deployContent.bat</Path>
</MsDeploySourceManifest>
</ItemGroup>
</Target>
Then, in deployContent.bat:
REM Detect MSDeploy location (stolen from VS generated CMD)
if "%MSDeployPath%" == "" (
for /F "usebackq tokens=1,2,*" %%h in (`reg query "HKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy" /s ^| findstr -i "InstallPath"`) do (
if /I "%%h" == "InstallPath" (
if /I "%%i" == "REG_SZ" (
if not "%%j" == "" (
if "%%~dpj" == "%%j" (
set MSDeployPath=%%j
))))))
"%MSDeployPath%mdeploy.exe" -verb:sync ^
-source:iisApp="application site name"
-dest:iisApp="static content site name",computerName=http://contentserver:8192/msdeploy.axd
-skip:File=^.*(?<!png|jpg|jpeg|css|js)$
... which deploys the site from the application server to the content server, skipping anything that does not have one of the predefined list of static content extensions.
(FYI: Don't try to sent arguments to your batch file unless it already exists on the server)