Compile error

Feb 17, 2013 at 3:07 PM
Edited Feb 17, 2013 at 3:08 PM
I am trying to use the sample code provided. I am trying to include the class VssBackup.cs and then use this in my program. Anyone knows what the problem could be?
I am not getting any Using issues with the dll.
Have items been renamed over various iterations of this wrapper - would that be the issue?
All i want is sample code in c# to backup locked files
thanks
Damo

I am getting 3 errors:

The type or namespace name 'Snapshot' could not be found (are you missing a using directive or an assembly reference?)
Snapshot _snap;
The type or namespace name 'IVssAsync' could not be found (are you missing a using directive or an assembly reference?
     using (IVssAsync async = _backup.GatherWriterMetadata())
     {.......
The type or namespace name 'Snapshot' could not be found (are you missing a using directive or an assembly reference?)
_snap = new Snapshot(_backup);
Mar 21, 2013 at 10:30 PM
What works for me is to not make use of these sample applications but rather just include the code lines to create the snapshot:
        IVssImplementation oVSSImpl = null;
        IVssBackupComponents oVSS = null;
        VssSnapshotProperties oProps = null;
        oVSSImpl = VssUtils.LoadImplementation();
        oVSS = oVSSImpl.CreateVssBackupComponents();
        oVSS.InitializeForBackup(null);
        oVSS.SetBackupState(false, true, VssBackupType.Full, false);
        oVSS.GatherWriterMetadata();
        Guid gSnapshotSet = oVSS.StartSnapshotSet();
        String sVolume = "C:\\";
        Guid gSnapshot = oVSS.AddToSnapshotSet(sVolume, Guid.Empty);
        oVSS.PrepareForBackup();
        oVSS.DoSnapshotSet();
        oProps = oVSS.GetSnapshotProperties(gSnapshot);