U4-8112 - Umbraco WebDeploy publishing includes files that should not be overwritten when publishing.

Created by Rasmus Eeg Møller 03 Mar 2016, 11:02:51 Updated by Rasmus Eeg Møller 04 Mar 2016, 10:56:31

What did you do? Created a WebDeploy publishing profile with the following config:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>MSDeploy</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    ... 
    <!-- We must not edit permissions trough WebDeploy, permissions are handled on the IIS -->
    <IncludeSetAclProviderOnDestination>False</IncludeSetAclProviderOnDestination>
    <!-- Exclude UmbracoForms data folder, we don't want to override -->
    <ExcludeFoldersFromDeployment>
      App_Plugins/UmbracoForms/Data
    </ExcludeFoldersFromDeployment>
    <!-- Exclude: Bower files, node.js files, grunt files and etc. -->
    <ExcludeFilesFromDeployment>
      Umbraco/Plugins/SEOChecker/Config/SEOChecker.config
    </ExcludeFilesFromDeployment>
  </PropertyGroup>
</Project>

Published the project.

What did you expect to happen? That the SEOChecker.config and App_Plugins/UmbracoForms/Data would not be copied.

What actually happened? They are being copied.

I've tried creating a .wpp.targets file to overrule any publishing settings, but that doesn't help.

I suspect the following file to UmbracoCms.targets

Any suggestions on how to solve this?

FIXED See: http://issues.umbraco.org/issue/U4-8112#comment=67-27183

2 Attachments

Comments

Sebastiaan Janssen 03 Mar 2016, 11:24:19

Either don't include this file in your project or set Build Action to None.


Rasmus Eeg Møller 03 Mar 2016, 11:37:06

@sebastiaan Forgot to mention that these files are not included in the project. But you are right, setting the SEOChecker.config to Build action none works for files, but not folder?


Rasmus Eeg Møller 03 Mar 2016, 11:38:19

@sebastiaan Oh almost forgot. SEOChecker.config location is: Umbraco/Plugins/SEOChecker/Config


Rasmus Eeg Møller 03 Mar 2016, 11:42:37

@sebastiaan If i create a stylesheet in css/style.css and add style.css to ExcludeFilesFromDeployment it does work.


Sebastiaan Janssen 03 Mar 2016, 11:56:02

I don't know, not much experience with publishing this way. Time to Google it.


Rasmus Eeg Møller 03 Mar 2016, 13:33:37

@sebastiaan When i uncomment

<!--
<CustomFilesToInclude Include=".\umbraco\**\*">
   <Dir>umbraco</Dir>
</CustomFilesToInclude>
-->

And re-opened visual studio

Hurray! The files are not included. But now the umbraco folder is not being published :-P

To be expected when the file or folder, is not included in the project.


Sebastiaan Janssen 03 Mar 2016, 13:38:57

did you install the site in some directory called umbraco perhaps? like C:\mysites\umbraco\? So your explorer tree would look something like C:\

  • mysites
    • umbraco
      • App_Browsers
      • App_Data
      • bin
      • ...
      • umbraco
      • umbraco_client


Rasmus Eeg Møller 03 Mar 2016, 13:43:18

@sebastiaan the path for my application is: c:\Respoitories\ClientName\Umbraco\Project.Web\ ?


Sebastiaan Janssen 03 Mar 2016, 13:49:34

Just thinking that maybe ".\umbraco***" would resolve to the parent node. But that doesn't make sense, never mind.


Rasmus Eeg Møller 03 Mar 2016, 14:07:17

@sebastiaan Nah, that would include the hole solution folder :-/


Rasmus Eeg Møller 04 Mar 2016, 07:12:08

@sebastiaan whoot! found this link. http://colours.nl/publicatie/msdeploy-how-can-we-deploy-file-only-once-per-solution

Will try it out and let you know how it goes :-)


Rasmus Eeg Møller 04 Mar 2016, 10:30:40

This .wpp.targets file works:

<?xml version="1.0" encoding="utf-8"?>
<!-- 
  Settings that you configure in the .wpp.targets file apply to all publish profiles. The following procedure explains how to create a .wpp.targets file.
  The documentation at: https://msdn.microsoft.com/en-us/library/ff398069#Anchor_1
  
  Any changes made to this file, requires close and open of visual studio.
  Because Visual Studio caches .targets files, changes made to one of them might not be effective until the next time Visual Studio is opened.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <!-- We must not edit permissions trough WebDeploy, permissions are handled on the IIS -->
    <IncludeSetAclProviderOnDestination>False</IncludeSetAclProviderOnDestination>
    <!-- Exclude: Bower files, node.js files, grunt files and etc. -->
    <ExcludeFilesFromDeployment>.bowerrc;bower.json;package.json;gruntfile.js;packages.config;*.ts;*.less;*.scss;</ExcludeFilesFromDeployment>
    <ExcludeFoldersFromDeployment></ExcludeFoldersFromDeployment>
    <!-- We don't or might want the app to be offline during deployment. -->
    <EnableMSDeployAppOffline>False</EnableMSDeployAppOffline>

    <AllowUntrustedCertificate>True</AllowUntrustedCertificate>
  </PropertyGroup>

  <PropertyGroup>
    <OnBeforePackageUsingManifest>
      $(OnBeforePackageUsingManifest);
      AddSpecificSkipRule;
    </OnBeforePackageUsingManifest>
    <AfterAddIisSettingAndFileContentsToSourceManifest>
      $(AfterAddIisSettingAndFileContentsToSourceManifest);
      AddSpecificSkipRule;
    </AfterAddIisSettingAndFileContentsToSourceManifest>
  </PropertyGroup>

  <Target Name="AddSpecificSkipRule" >
    <ItemGroup>
      <MsDeploySkipRules Include="SkipSeoCheckerConfig">
        <ObjectName>filePath</ObjectName>
        <AbsolutePath>Umbraco\\Plugins\\SEOChecker\\Config\\SEOChecker\.config$</AbsolutePath>
      </MsDeploySkipRules>
      <MsDeploySkipRules Include="SkipUmbracoFormsData">
        <ObjectName>filePath</ObjectName>
        <AbsolutePath>App_Plugins\\UmbracoForms\\Data\\.*$</AbsolutePath>
      </MsDeploySkipRules>
    </ItemGroup>
  </Target>
</Project>

Beware now we are completely excluding these folders and files from ever being deployed. Which means, you must manually upload them afterwards. The best part is, this can be done using Publish Selected, from inside visual studio.


Sebastiaan Janssen 04 Mar 2016, 10:39:22

Great to hear. I'm still going to close this as we have set up things so that Umbraco itself deploys correctly, we can't be responsible (in the core) for plugins to deploy correctly (yes, Forms is a plugin, even if it's ours, it doesn't ship with the core).


Rasmus Eeg Møller 04 Mar 2016, 10:56:31

@sebastiaan Sure thing m8! Just wanted to keep it alive, for anyone else who might have the related issues.


Priority: Normal

Type: Usability Problem

State: Closed

Assignee:

Difficulty:

Category:

Backwards Compatible: True

Fix Submitted: Inline code

Affected versions: 7.3.7

Due in version:

Sprint:

Story Points:

Cycle: