« Previous Next »

Thread: Replace content path when sync

Last post 07-14-2009 7:06 AM by linus78. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 07-07-2009, 4:00 AM

    • linus78
    • Top 500 Contributor
    • Joined on 09-05-2007, 8:36 AM
    • Posts 17

    Replace content path when sync

     I try to replace the content path when I sync a website from one iis7 to another. Unfortunately it is not working. No error, but it does not replace the path. I tried it these two different ways:

    msdeploy -verb:sync -source:apphostconfig="website1" -dest:apphostconfig="website1",computername=targetcomputer -enableLink:AppPoolExtension -replace:scopeAttributeName=name,scopeAttributeValue=path,targetAttributeName=value,match="D:\wwwroot\website1",replace="\\storage\ShareforWebroots\website1"

    msdeploy -verb:sync -source:apphostconfig="website1" -dest:apphostconfig="website1",computername=targetcomputer -enableLink:AppPoolExtension -replace:objectName=contentPath,scopeAttributeName=path,match="D:\wwwroot\website1",replace="\\storage\ShareforWebroots\website1"

    The replace does not take effect:

    Action: Adding dirPath (D:\wwwroot\website1)
    Action: Adding child dirPath (D:\wwwroot\website1\imagesProducts)
    Action: Adding child filePath (D:\wwwroot\website1\imagesProducts\...

    Any idea what is wrong with my syntax?

    Thanks for comments!

    Regards linus

     

  • 07-07-2009, 10:50 AM In reply to

    Re: Replace content path when sync

    You can use setParam as follows:

    msdeploy -verb:sync -source:apphostconfig=website1 -dest:apphostconfig=website1,computername=targetcomputer -enableLink:AppPoolExtension -setParam:type=DestinationVirtualDirectory,scope=website1,value=\\storage\ShareforWebroots\website1

    You can read more about setParam here

    Let us know if you need more info

  • 07-07-2009, 1:29 PM In reply to

    Re: Replace content path when sync

    To give a little more detail, the reason why your -replace syntax didn't work is because you didn't match the configuration setting. 

    What you really want to do is sync the new site but change the virtual directory path for the site as you go.  If you do a "msdeploy -verb:dump -source:apphostconfig=website1 -xml" you will the XML view of the source site.  From that, you need to craft a replace rule which matches part of that source tree and changes it. 

    In this case, you'll want to change the virtualDirectory element, by changing the physicalPath attribute from d:\wwwroot\website1 to \\storage\blah

    So, the minimal replace rule should be:

    -replace:objectName=virtualDirectory$,targetAttributeName=physicalPath,replace=\\storage\blah

    Of course, this rule will replace EVERY virtualDirectory in the destination to point to \\storage\blah.  If you want to simply replace the root virtualDirectory, you add a scopeAttributeName=path,scopeAttributeValue=/

    The -replace mechansim is a swiss-army knife approach the aims for flexibility, but is difficult to grok and too flexible.  That's why we added more common case -setParam types which allow for the common cases (like changing a virtual directory).

    Hope that helped <g>

  • 07-14-2009, 7:06 AM In reply to

    • linus78
    • Top 500 Contributor
    • Joined on 09-05-2007, 8:36 AM
    • Posts 17

    Re: Replace content path when sync

    That works! Thanks a lot!

Page 1 of 1 (4 items)
Microsoft Communities