dsccommunity / xWebDeploy

MIT License
8 stars 13 forks source link

Test-Resource does not correctly see differences when files were updated #21

Open wmeints opened 6 years ago

wmeints commented 6 years ago

After using the xWebDeploy resource twice I discovered that it only sees files that were added or deleted. Updated files are not detected. And because of that the webdeploy command to sync the package with the target folder/IIS site is not executed.

I think this is because of this code from xWebPackageDeploy.psm1:

if($Ensure -eq "Present")
{
    #find all the files for a given site
    $siteFiles = & $appCmd -verb:dump "-source:contentPath=$Destination"
    # the packages exported using webdeploy tool, contain 2 extra entries with site name. Skipping those..
    #compare based on the number of files
    if(($packageFiles.Count -eq $siteFiles.Count) -or (($packageFiles.Count -2) -eq $siteFiles.Count) )
    {
        $result = $true
    }
}   

I would expect something like:

msdeploy -verb:sync -source:package="..." -dest:contentPath="..." -whatif

The problem is however that this command doesn't return a very usable result for powershell to process.

If anyone knows a better way to deal with updated files, I'm all ears!

wmeints commented 6 years ago

I fixed the problem myself by writing a regex pattern to parse the output of msdeploy.exe