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

Juan Dent 236 Reputation points
2022-08-03T17:48:45.883+00:00

I downloaded code https://learn.microsoft.com/answers/users/53807/karenpayneoregon.html but when I opened the solution file in VS2022 it gives me this error:

Couldn't process file Form1.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.

Can you help please?

C#
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.
10,308 questions
{count} votes

5 answers

Sort by: Most helpful
  1. Karen Payne MVP 35,196 Reputation points
    2022-08-03T19:11:20.587+00:00

    There are 3 ways to remove mark of the web

    • Right click on the file in windows explorer, select properties. At bottom of the first page is a check box to remove mark of the web. This needs to be done with Visual Studio closed.
    • Use PowerShell, open the folder for the project in PowerShell and issue dir -Path . -Recurse | Unblock-File or Get-ChildItem -Path . -Recurse | Unblock-File
    • Use my remove mark of the web app

    With that said, if you were to clone my code using Visual Studio or Git-Desktop you would not get mark of the web. This only happens with .zip files.

    3 people found this answer helpful.

  2. Jan Friborg 5 Reputation points
    2023-03-07T07:31:48.37+00:00

    I keep running into a similar issue with different versions of Visual Studio, but my problem is not related to blocking of web files as described above.

    My issue is a combination of having the project files stored on a OneDrive drive and the form.resx file containing icons or images.

    My solution is to remove the icon and images from any image libraries stored in the form file, add the files to the project resources (icons/images) and then add the icon or images to the imagelibrary by code. For some reason this is good enough for Visual Studio even if OneDrive has marked the file to be synchronized.

    Main.cs form initialization code as something like below:

    public Main()
    {
        InitializeComponent();
    
        this.Icon = Properties.Resources.app_icon;
        this.ilNodes.Images.Clear();
        this.ilNodes.Images.Add("WORD", Properties.Resources.File_DOC);
        this.ilNodes.Images.Add("PDF", Properties.Resources.File_PDF);
        this.ilNodes.Images.Add("ZIP", Properties.Resources.File_ZIP);
     }
    

    Best regards,

    Jan

    1 person found this answer helpful.
    0 comments No comments

  3. Juan Dent 236 Reputation points
    2022-08-03T19:44:57.177+00:00

    I downloaded again by cloning with VS2022 and the error remains the same. I am trying to build Async_simple project and I get:

    error MSB3821: Couldn't process file Form1.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.

    I tried

                    Get-ChildItem -Path . -Recurse | Unblock-File   
                    dir -Path . -Recurse | Unblock-File  
    

    and error continues....

    There is something in form1.resx !!

    I cannot solve my original problem and the proposed solution isn't buildable!!

    please help!


  4. Juan Dent 236 Reputation points
    2022-08-03T21:38:40.197+00:00

    I ran the command in Powershell to no avail.

    i think it has to do with .NET versions because the IDE selects this code when it reports the error:

    <!-- 4.0 task has some new parameters that we want to make use of if we're targeting 4.0 -->  
    <GenerateResource  
    

    and the window that shows this error is: C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets

    I have the following installed dotnet runtimes:

    PS C:\users\juan_\OneDrive\C#\cloned-with-VS2022> dotnet --list-runtimes
    Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.AspNetCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.AspNetCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
    Microsoft.NETCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.NETCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.NETCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    Microsoft.WindowsDesktop.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

    PS C:\users\juan_\OneDrive\C#\cloned-with-VS2022> dotnet --list-sdks
    6. 0.301 [C:\Program Files\dotnet\sdk]
    6. 0.302 [C:\Program Files\dotnet\sdk]

    Please help, I am quite new to .NET and i am trying to learn XAML and WPF which is why your sample for IProgress is a bit off since you use Windows Forms... still, it should compile I think!!

    Regards,
    Juan


  5. Karen Payne MVP 35,196 Reputation points
    2023-04-29T10:57:13.3666667+00:00

    For anyone having this issue see Mark of the web remover.

    0 comments No comments