VS2022 c# File.Copy weird behaviour after upgrade to Office 365

Gegg-8342 21 Reputation points
2026-01-12T18:13:53.1933333+00:00

We have a small windows desktop app (.NET 4.8) that creates a copy of some data it grabs from and ODBC connection and stores it in an MS Access database which in connects to via oledb. This has been working perfectly well for a long time.

We have a blank database file in a folder in the application path, the database file has been renamed to base.bin. When the copy process is initiated by the user, the base.bin file is copied to the required location and named [newname].accdb with the following line :-

File.Copy(AppDomain.CurrentDomain.BaseDirectory + @"\db\base.bin", [FolderName] + @"" + [DatabaseName] + ".accdb");

Although the file is created, when we now try to connect to the new database using oledb and run the import process, it fails with the error :- "The database you are trying to open requires a newer version of Microsoft Access."

If we rename the base.bin file to base.accdb and alter the copy code to :-

File.Copy(AppDomain.CurrentDomain.BaseDirectory + @"\db\base.accdb", [FolderName] + @"" + [DatabaseName] + ".accdb");

It works again as normal?

I would be very grateful for any thoughts on this as it seems very odd indeed.

Thanks

Geoff

Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

Answer accepted by question author
  1. Michael Le (WICLOUD CORPORATION) 10,840 Reputation points Microsoft External Staff Moderator
    2026-01-13T07:06:40.3833333+00:00

    Hello @Gegg-8342 ,

    Thanks for sharing these details.

    This issue seems to be related to how Office 365 implements security checks on Access database files rather than a problem with File.Copy itself.

    When you copy base.bin to [newname].accdb, Windows attaches metadata to track that this file was renamed from a different extension. Office 365 sees this metadata and becomes suspicious—it thinks something fishy is going on. The error message about "requiring a newer version" is misleading; it's actually Access refusing to open the file for security reasons, not a version compatibility issue.

    When you copy base.accdb to [newname].accdb instead, Windows recognizes this as a normal database file duplication. There's no suspicious extension change, so Office 365 opens it without complaint.

    This behavior is a side effect of Microsoft's enhanced security features in newer Office versions. They're trying to prevent malware that disguises itself by using misleading file extensions. Your workaround of keeping the source file as .accdb is fine—there's no real benefit to naming it .bin, and modern Office security actively dislikes that pattern.

    If you'd like to suggest an improvement to the user experience around this scenario, sending feedback through the Feedback Hub app would be a good way.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.