[c#] Couldn't process file resx due to its being in the Internet or Restricted zone or having the mark of the web on the file

I am facing an issue while debugging c# API Coding in Visual studio 2017. Debugging not started and showing a error message like

enter image description here

Any idea about this error message?

This question is related to c# api

The answer is


Solution: Edit and save the file!

From VisualStudio go to the View and expand to see it's resx file

Right-click menu select OpenWith... XML (Text) Editor.

Just add a space at the end and save.


  1. Open the file explorer. Navigate to project/solution directory
  2. Search for *.resx. --> You will get list of resx files
  3. Right click the resx file, open the properties and check the option 'Unblock'
  4. Repeat #3 for each resx file.
  5. Reload the project.

Complementing @lasse-v-karlsen answer. To unblock all files recursively, run from powershell as administrator inside the folder you want:

gci -recurse | Unblock-File

source link: How to Unblock Files Downloaded from Internet? - Winhelponline
https://www.winhelponline.com/blog/bulk-unblock-files-downloaded-internet/


None of these answers worked for me, I had to do the following:

  1. Start Menu > type 'Internet Options'.
  2. Select Local intranet zone on the Security tab then click the Sites button
  3. Click Advanced button
  4. Enter file://[computer name]
  5. Make sure 'Require server verification...' is unticked

Source: https://superuser.com/q/44503


None of the suggestions above worked for me so I created a new file with a slightly different name and copied the contents of the offending file into the new file, renamed the offending file and renamed the new file with the offending file's name. Worked like a charm. Problem solved.


If you downloaded the file from the internet, either separately or inside a .zip file or similar, it may have been "locked" because it is flagged as coming from the internet zone. Many programs will use this as a sign that the content should not be trusted.

The simplest solution is to right-click the file in Windows Explorer, select Properties, and along the bottom of this dialog, you should have an "Unblock" option. Remember to click OK to accept the change.

If you got the file from an archive, it is usually better to unblock the archive first, if the file is flagged as coming from the internet zone, and you unzip it, that flag might propagate to many of the files you just unarchived. If you unblock first, the unarchived files should be fine.

There's also a Powershell command for this, Unblock-File:

> Unblock-File *

Additionally, there are ways to write code that will remove the lock as well.

From the comments by @Defcon1: You can also combine Unblock-File with Get-ChildItem to create a pipeline that unblocks file recursively. Since Unblock-File has no way to find files recursively by itself, you have to use Get-ChildItem to do that part.

> Get-ChildItem -Path '<YOUR-SOLUTION-PATH>' -Recurse | Unblock-File

I had this issue on resx files in my solution. I'm using Onedrive. However none of the above solutions fixed it.

The problem was the icon I used was in the MyWindow.resx files for the windows.

I removed that then grabbed the icon from the App Local Resources resource folder.

 private ResourceManager rm = App_LocalResources.LocalResources.ResourceManager;
 
 ..
 
InitializeComponent();
this.Icon = (Icon)rm.GetObject("IconName");

This happened after an update to VS2019.


If you are using OneDrive, or any similar network drive, you have 2 options:

1) the easy one is to move the folder to a local directory inside your PC (eg:. C:).

2) but if you want to keep using OneDrive I would recommend to add it to the trusted sites on the internet explorer options and that will fix the problem.

enter image description here


I stumbled upon another possible reason of this error. If you use NTFS symbolic links in your project tree, and probably subst'ed drives, you may get this error even if they point to your local drive. If this is the case, try to avoid the situation when .resx files are reached via symlinks.


  1. Find the path from error log and open the file in explorer 2)select the file and right-click -> properties
  2. Then check the 'unblock' option and click on apply enter image description here

Although this is an older question, I spent several hours tracking down a way to handle this error when it applies to multiple files that are located in sub folders throughout the project.

To fix this for all files within a project, Visual Studio -> Tools -> Options -> Trust Settings and add the project path as a trusted path.

Visual Studio trusted paths


If, like me, you have diligently followed all the above solutions and the error is still there, try closing and reopening Visual Studio.

Obvious, I know, but perhaps I'm not the only one who's become fuzzy-brained after staring at a computer screen all day.


None of the above worked.

  • The "Unblock" option is not present in the explorer properties.
  • Recreating file, adding folder (and resx file) to Tools->Options->Trust Settings does not work.

The solution was to copy the project locally (from the network drive).


None of the above worked for me.

This happened to me after I added a new button to a toolstrip on a winform. When the button uses the default image of System.Drawing.Bitmap (in image property) this error arose for me. After I changed it to a trusted image (one added to my resource file with 'Unlock' option checked) this error resolved itself.