5

I am using the DSC File Resource to update the application server with the latest build. This works great except for .PDB files. These never get updated. I've reproduced this behavior with just a single file. Here is a sample configuration

Configuration FileTestConfiguration {
    param($HostName)

    Node $HostName {
        File AppDirectory {
        SourcePath = "c:\temp\dsc\source"
        DestinationPath = "c:\temp\dsc\target"
        Type = 'Directory'
        Checksum ='SHA-256'
        Recurse = $true
        MatchSource = $true
    }
    File PdbFile {
        SourcePath = "c:\temp\dsc\pdbSource\MyNetHelpers.pdb"
        DestinationPath = "c:\temp\dsc\pdbTarget\MyNetHelpers.pdb"
        Checksum ='SHA-256'
        Recurse = $true
        MatchSource = $true
    }
}

}

After running the configuration above the directory target will reflect the directory source, except for the .pdb file. The same behavior is exhibited with a single file as in the PdbFile block

I have run a number of tests with renaming of files, but this has no affect. It seems to be related to the .PDB format.

Has anyone seen this behavior, know what causes it or know if the configuration above is incorrect?

  • Very interesting. What if you rename the same PDB file to have a different extension? What if you make a .txt file and name that with .pdb? – briantist Nov 10 '15 at 20:23
  • Yep, did all that. Regardless of name, pdb content files do not get overlaid while others do. – Bernard Odoy Nov 10 '15 at 20:25
  • Great info; what if you change the checksum (or don't use one at all)? – briantist Nov 10 '15 at 20:26
  • Good thought on the no checksum. I had tried all the other checksums algorithms, but they do not matter. I did verify that the file checksums are different also. Looking at the docs having no checksum defaults to matching on name which is no good. The other option is to use the value modifiedDate for checksum. I did just test this and this will copy all files including PDB files. There appears to be different behavior for PDBs with checksum algorithm – Bernard Odoy Nov 10 '15 at 20:39
  • Might be a good candidate for a Microsoft Connect bug. I can't think of any reason why checksum would know about different file types (let alone care). Very strange; I'll be looking out for this in future configurations for sure. I imagine it must affect some other file types. – briantist Nov 10 '15 at 20:43
  • got this fixed in a way? – Falco Alexander Aug 04 '16 at 11:34

1 Answers1

0

I just stumbled over such an issue. For me the perfect workaround: Archive

That worked fine, at least for me

Sample:

Archive ArchiveSourcezip
{
    Ensure = 'Present'
    Path = '\\Source\Directory\source.zip'
    Destination = 'C:\ExtractionPath'
}

Log LogExample
{
    Message = 'Archive source.zip was transferred.'
}

Edit: Another option: Use modifiedDate als Checksum Test! that seems to be most reliable.

File ScriptsPowerShellPath {
    Ensure = 'Present'
    Type = 'Directory'
    Recurse = $true
    SourcePath = '\\Server\share'
    DestinationPath = $env:SystemDrive+'\directrory\target'
    Force = $true
    Checksum = 'modifiedDate'
    MatchSource = $true
    DependsOn = '[File]ScriptsPath'
}

And you might also want to use a Log-Resource:

Log LogFileScriptsPowerShellPath {
    Message = 'Created and filled ScriptsPowerShellPath'
    DependsOn = '[File]ScriptsPowerShellPath'
}

That could be useful.