Skip to content
This repository has been archived by the owner on Apr 10, 2020. It is now read-only.

WebPublishMethod = Package doesn't work #22

Closed
scabana opened this issue Aug 11, 2015 · 14 comments
Closed

WebPublishMethod = Package doesn't work #22

scabana opened this issue Aug 11, 2015 · 14 comments

Comments

@scabana
Copy link

scabana commented Aug 11, 2015

I was able to get a vso build to publish an asp.net 5 website with <WebPublishMethod>FileSystem</WebPublishMethod>. Which is a good start. I tried getting <WebPublishMethod>Package</WebPublishMethod> to work but it doesn't seem to be picked up.
If I use <WebPublishMethod>MSDeploy</WebPublishMethod>, I would need to provide for which exact website (url, publish url) you want to deploy which is not so nice if you want to have multiple environments.

My goal is to get a zip file and a cmd (or ps1) file to deploy my website using web deploy. That cmd (or ps1) file would accept arguments such as url, publish url, username, pw and so on so that we can deploy to different environments without the need to recompile.

I might be looking in the wrong direction, if I am, I would be happy to change the way we're doing things.

@sayedihashimi
Copy link
Contributor

Package support may not work well currently, thats why we have not enables it in the publish dialog yet. I can help you with it though.

For package you'll need to also add 'DesktopBuildPackageLocation' as a property in the .pubxml. Can you try adding that and publish from vs to see if it works?

@scabana
Copy link
Author

scabana commented Aug 11, 2015

Yeah, I tried that before and I get: The target "Package" does not exist in the project. MyProj.xproj. That target comes from Microsoft.Web.Publishing.targets which doesn't seem to be used when publishing asp.net 5 projects.

We can get around with the current FileSystem publishing for now, but it would be good to get this feature enabled back!

Thanks for the quick reply!

@sayedihashimi
Copy link
Contributor

@scabana can you verify that you have the Use Powershell checkbox set to true? There is also a property in the .pubxml UsePowershell IIRC.

@scabana
Copy link
Author

scabana commented Aug 14, 2015

@sayedihashimi here's the pubxml file's content:

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>Package</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <CompileSource>True</CompileSource>
    <UsePowerShell>True</UsePowerShell>
    <WebRoot>wwwroot</WebRoot>
    <publishUrl>..\..\artifacts\bin\Api\PublishOutput</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <DesktopBuildPackageLocation>..\..\artifacts\bin\Api\PublishOutput2</DesktopBuildPackageLocation>
  </PropertyGroup>
</Project>

I tried removing the publishUrl node, then the logs shows it's using the DesktopBuildPackageLocation, but then I get the The target "Package" does not exist in the project. error.

Thank you very much for taking the time to take a look into this!

@sayedihashimi
Copy link
Contributor

@scabana try the following instead.

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <CompileSource>False</CompileSource>
    <UsePowerShell>True</UsePowerShell>
    <WebRoot>wwwroot</WebRoot>
    <publishUrl>..\..\artifacts\bin\WebApplication3\Release\PublishOutput</publishUrl>
    <DeleteExistingFiles>False</DeleteExistingFiles>

    <WebPublishMethodOverride>Package</WebPublishMethodOverride>
    <DesktopBuildPackageLocation>..\..\artifacts\bin\Api\PublishOutput2\web.zip</DesktopBuildPackageLocation>
  </PropertyGroup>
</Project>

@scabana
Copy link
Author

scabana commented Aug 18, 2015

Nice! The method override worked! Thanks a lot!

@scabana scabana closed this as completed Aug 18, 2015
@sayedihashimi
Copy link
Contributor

@scabana ok great. One question, did you have any issues publishing the generated web package? We haven't tested that much since the option isn't available yet.

@scabana
Copy link
Author

scabana commented Aug 18, 2015

It doesn't seem to be very happy, tried to deploy with this command line: "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:package='d:\package.zip' -verb:sync -dest:auto,publishSettings='d:\Site.PublishSettings' where the Site.PublishSettings comes from Download the publish profile button in my azure web app. When I run that I get a windows 8 modal popup: This app can't run on your PC.

I also tried: "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:package='d:\package.zip' -verb:sync -dest:auto,computerName=https://{sitenamehere}.scm.azurewebsites.net:443/MsDeploy.axd,username={usernamehere},password={passwordhere},authtype=basic but then I get this error:

Error Code: ERROR_INSUFFICIENT_ACCESS_TO_SITE_FOLDER
More Information: Unable to perform the operation ("Create Directory")  for the specified directory ("wwwroot"). This can occur if the server administrator has not authorized this operation for the user credentials you are using.
Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_INSUFFICIENT_ACCESS_TO_SITE_FOLDER.

So, havent, found the right command line to call yet. I'll continue the investigation.

@sayedihashimi
Copy link
Contributor

Try adding -enableLink:contentLibExtension to your second command.

@scabana
Copy link
Author

scabana commented Aug 18, 2015

@sayedihashimi
That was needed, but it was also missing the IisApp parameter, here's the full solution:

"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:package="{packagezipfilelocation}" 
                                                            -verb:sync 
                                                            -dest:publishSettings={azurepublishsettingsfile},IisApp='{applicationName}' 
                                                            -enableLink:contentLibExtension 
                                                            -disableLink:AppPoolExtension 
                                                            -disableLink:ContentExtension 
                                                            -disableLink:CertificateExtension 

Now it published, I am getting a 500 internal server error, probably means I'm missing stuff in the .zip file. Hoping it's not an msdeploy problem. I'll continue investigating tomorrow and report back!

Thanks for your help!

@scabana
Copy link
Author

scabana commented Aug 19, 2015

@sayedihashimi
Seems like my 500 internal server error is my project's problem. I tried with a brand new project and it seems to work fine!

Everything's working as expected now!

@sayedihashimi
Copy link
Contributor

@scabana that's great to hear! FYI a common reason for 500s is a mismatch in bitness. If you publish 64 bit make sure to configure your app pool as such. Can we close this issue?

@scabana
Copy link
Author

scabana commented Aug 19, 2015

@sayedihashimi
It's already closed! I guess there's a work item somewhere to enable it through the UI?

@sayedihashimi
Copy link
Contributor

Sorry about that I didn't notice (was replying on my phone). Yeah, I'm tracking package support.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants