richardszalay / helix-publishing-pipeline

Unified publishing for Sitecore Helix solutions that extends existing Visual Studio and command line workflows
MIT License
68 stars 18 forks source link

Targeting an IIS site breaks 'publish on build' #51

Open muso31 opened 5 years ago

muso31 commented 5 years ago

If the PublishUrl is set to an IIS site url then the publish on build feature does not work.

muso31 commented 5 years ago

Possible PEBCAK, the Release profile may have been selected and there's a condition on EnableAutoPublish for Debug only. Investigating...

muso31 commented 5 years ago

Ok this is an issue. The error is below:

Error This specific WebPublishMethod(FileSystem) is not yet supported on msbuild command line. Please use Visual Studio to publish.

richardszalay commented 5 years ago

I'm starting to look into this now and I don't actually think the FileSystem publish actually supports URLS.

In Microsoft.Web.Publishing.Deploy.FileSystem.targets, you can see this:

<PropertyGroup>
  <_HttpHeader>http://</_HttpHeader>
  <_DoWebFileSystemPublish Condition="'$(PublishUrl)'!='' And '$(PublishUrl.StartsWith($(_HttpHeader),  StringComparison.OrdinalIgnoreCase))' == 'False' And '$([System.IO.Path]::GetFullPath($(PublishUrl)))' != ''">True</_DoWebFileSystemPublish>
</PropertyGroup>

Which seems to indicate that it requires that PublishUrl is actually a path. You could use a regular (non-FileSystem) publish profile, but you'd have to fix the autopublish to work with it and also you'd lose any HPP features that rely on knowing the target directory (remove additional, skipping unchanged transforms).

muso31 commented 5 years ago

When setting up a publish profile in visual studio if I click the '...' next to 'Target location' one option is to select 'Local IIS' where we can target an IIS site, I think all's this does is set the PublishUrl to a Url rather than a Path, and it still uses a FileSystem publish type. Does this suggest that FileSystem publish supports Urls, or am I missing something? Unless it converts the url to a path under the hood?