C# Couldn't process file xxx.resx due to its being in the Internet or Restricted zone or having the mark of the web on the file

笑着哭i 提交于 2020-01-01 07:36:48

问题


I have issue while i try to build project in VS2012.

Can't build due to error:

Couldn't process file xxx.resx due to its being in the Internet or Restricted zone or having the mark of the web on the file. Remove the mark of the web if you want to process these files.

similar question is here 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

but I try that option and have no luck, because I didn't downloaded file from internet. That project was build from scratch. In project after selecting Properties, in Windows Explorer nothing happened, i don't have "unblock" option, only default 3 options (read only, hidden, archived).

I have same error and can't build or rebuild project. I have theory that is recent error after update Windows. Before update, everything works fine. Any ideas ?


回答1:


Go to xxx.resx file in Windows File Explorer. Right-click and select properties. At the bottom of the the dialog is an "unblock" option:

Check this and click Apply. Clean your solution and it will build.




回答2:


Had the same problem after updating to VS 2017 v15.8.5, and none of the solutions above or on other forums worked for me.

So, since a .resx file is just XML, I just copied the content, deleted the original file and recreated it with the copied content.

That was the only thing that worked, and it worked first time.




回答3:


In my case I had the same problem with many files.

My solution with VS Prof. 2017 V15.95 was:

  1. open powershell and execute "dir -Path [directory path] -Recurse | Unblock-File"

  2. rebuild all




回答4:


I'm not really sure either, I have the exact same issue.

But, what i did, was hit view in file explorer.

Then, i clicked show hidden items.

Finally, i went back to my folder and clicked on the .vs folder, my project/file name, v15, Server, sqlite3, and deleted DB.Lock.

I reopened the project, clicked build, and it worked perfectly.

This worked for me, it might/might not for you.




回答5:


  1. On the solution folders locate abc.resx.

  2. Open the file using any text editor, preferably Notepad++.

  3. Locate and delete any node starting with "

Example. This is what you should delete.

<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
        AAABAAMAICAAAAEAIACoEAAANgAAAGBgAAABACAAqJQAAN4QAACAgAAAAQAgACgIAQCGpQAAKAAAACAA
        AABAAAAAAQAgAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 
         ///////////8AAB///////// 
     </value> 
 </data>
  1. Reload or reopen your solution and build. You are ready to go.



回答6:


I found this solution on another forum. My project resided on a file share, so I had to enter file://[file share] for Step 4 below. I am running VS2019 on Windows 10.

  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] or file://[file share]
  5. Make sure 'Require server verification...' is unticked



回答7:


I just ran into the same issue and also tried the Unblock option from explorer with no luck. I even restarted VS with no luck.

However, I'm not sure which combination did the trick but I opened the form as well as the resx file from within VS, just to see if I can open it, which opened fine. I then did a clean and rebuild and that appeared to do the trick. If it doesn't try restarting VS after the clean then rebuild.




回答8:


I had a similar issue and the problem was an image that I had downloaded and added to my Resources. Not completely sure why that was the only image that gave me problems, however, I opened my abc.resx file giving me issues an a text editor, removed the node starting with " (it was the last and only node) just like Albert Alberto mentioned. Saved the changed, cleaned and rebuilt my solution and it all works! The image didn't render but it only took a second to go back and add the image. It wasn't removing the entire file, just the node that was causing the issue.




回答9:


I also encountered this issue recently. The error began occurring after I set the icon of a Windows Form.

Researching for the cause and solution almost led me nowhere, because I did not download the icon from the internet, nor was I referencing a web-based icon file. It was stored entirely on my local machine.

After some more researching and digging around, I was able to figure out exactly what was causing the problem. I have Microsoft One-Drive installed on my machine. The directory in which the icon file was located is managed/synced by One-Drive. That fact was somehow tricking Visual Studio into believing the file was located or downloaded from the internet.

The solution proved to be very simple. I removed the icon from the form, as well as from the corresponding .resx file. Then I moved the icon file to another directory not associated with One-Drive. Finally, I was able to use that icon in my Windows Forms application without getting this error.

I understand there are other possible causes for this error. But if in your case, the issue happened after setting a form's icon--and if you have One-Drive (or perhaps another cloud-based storage solution) installed--then check to be sure that icon file is not in a directory managed by that service. If so, relocate it and change the form's icon property to point to the new location.




回答10:


I had the same problem on Windows 10, VS 2017 (15.9.13). I sent myself a project from work through Dropbox so I could try a couple of things from home. But when I tried to build it VS gave me the 'marked for web' error.

After trying the solutions above without success I began experimenting. I was able to solve this by using the method listed above (right click -> properties -> unblock), but I had to do it for each of the images in the Resource folder--and I had to do EACH FILE individually since the 'unblock' option was not available on group-selects. I actually unblocked each source file in the project as well before trying to rebuild so I am not sure if both are required.

Its a bit of a pain--probably a huge pain for larger projects--but it absolutely got the project building again.

EDIT: I did find this article afterwards about unblocking entire folders--even recursively but have not tried it: https://www.winhelponline.com/blog/bulk-unblock-files-downloaded-internet/




回答11:


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



来源:https://stackoverflow.com/questions/51356602/c-sharp-couldnt-process-file-xxx-resx-due-to-its-being-in-the-internet-or-restr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!