I'm getting the error "System.IO.IOException: The process cannot access the file because it is being used by another process" while trying to move a file i just created myself in the code, while running the code as batch. I have no problems running it as a client. I have tried Googelling and some of the suggestions are incl. below but uncommentted since it did not work. (filenameOutTemp is the one i can't access)
...
asciiIoOut = new AsciiIo(filenameOutTemp, #io_append);
asciiIoOut.outFieldDelimiter(#fieldDelimiter);
if (createFile)
{
// Replace the vend account from DDD with local:
record = conpoke(record, colVendDDD, vendSetupDDD.VendAccount);
asciiIoOut.writeExp(record);
}
}
//CodeAccessPermission::revertAssert();
asciiIoOut.finalize();
asciiIoOut = null;
//Move from temp folder to vender item folder:
fshVendTable = RetailVendTable::find(vendSetupDDD.VendAccount);
filenameOut = fshVendTable.filePathImport(VendorFileImportPath::Items);
filenameOut += #filePathSeperator + substr(inventImportFiles.Filename,1, strLen(inventImportFiles.Filename) - 4 );
filenameOut += #spacer + #item + #spacer + filenameDate + #spacer + filenameTime + #csv;
//new InteropPermission(InteropKind::ClrInterop).assert(); // get dll interop permission
try {
System.IO.File::Move(filenameOutTemp, filenameOut);
}
catch(Exception::Error) {
warning("move failed");
}
hope someone can please help :)