The current .NET security policy prohibits C:\Users\...\File.xlsx from loading custom macros.

Ricardo Freccero 1 Reputation point
2023-01-19T01:59:19.6166667+00:00

I am working on a project in Visual Studio Community 2022. The project is an Excel VSTO Workbook using Visual Basic (Target framework is .NET Framework 4.8). Up until yesterday everything was working fine, I could run and debug my project whenever I needed to but yesterday I updated Visual Studio and now when I try to debug the program I get the following alert from Microsoft Office:

"The current .NET security policy prohibits C:\Users...\FileName.xlsx from loading custom macros. You can still edit and save the current document. Contact your IT administrator or the author of the custom macros for further assistance."

The following are the things I've done to try and solve this issue:

  • Went back to the previous version of Visual Studio.
  • Ran sfc /scannow command on the cmd and there were no system violations
  • Updated my .NET Framework to the latest version.
  • Repaired Visual Studio

None of these made any progress on solving this issue.

I also created a new VSTO Workbook projects but this time with a target framework of .NET Framework 4.7.2 but I keep getting the same message when I try to debug it or run it on Release mode.

I am running Windows 11 and 64-bit Office with Microsoft 365 subscription.

My current Visual Studio Community 2022 version is 17.4.2

My current Excel version is Version 2303 Build 16.0.16110.20000

When I check my current .NET Framework version on CMD it shows:

Microsoft (R) Build Engine version 4.8.9032.0

[Microsoft .NET Framework, version 4.0.30319.42000]

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,190 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,441 questions
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,327 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,318 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Abraham Valencia 0 Reputation points
    2023-02-03T19:42:40.97+00:00

    it was a Microsoft 365 Insider Beta issue; with today’s update, there is no problem anymore.

    0 comments No comments