Sage 300

Sage 300 is accounting software for small to medium sized enterprises that fulfills all your accounting needs.

Customised and tailored by Astech

Sage CRM

Customer Relationship Management Software- Sage CRM is a powerful and easy-to-use customer relationship management solution that integrates directly with both Sage 300 and SAGE ERP X3.

Customised and tailored by Astech

Credit Management Solutions

The Astech Credit and Loan Management Solution (LMS) is a comprehensive end to end business software solution for credit providers.

Customised and tailored by Astech

Cannot process file because of mark of the web error in Visual C# project

We have been working on an Outlook VSTO Plugin as part of a product that we are selling at As-tech.  Often, when trying to build or publish the plugin, we encounter an error complaining that the project cannot be build because one of the resource files had the Mark of the Web (see below):

It claims that the Mark of the Web needs to be removed in order to process the file, but it soon became obvious that this was not necessarily a simple process.

What is the Mark of the Web?

The Mark of the Web is a feature that was introduced by Microsoft to determine the origin of a file.  If a file was downloaded from the Internet or from another location on a network, it would contain a comment in the file identifying the zone from which the file was downloaded from.  Depending on this zone (e.g. intranet, Internet etc) Windows would handle the file accordingly so as to avoid users from running or opening potentially harmful files from untrusted sources.

But why do I get this error?

The Mark of the Web is a great feature to have, but it's really unnecessary and confusing when we see it in Visual Studio while trying to build our project.  But fear not, there are a few solutions to solve this error.  Unfortunately there is no single solution that works every time so below you will find a list of possible solutions that have been gathered from around the web as well from our own experience with the hope that one of them will help you resolve the issue.


Solutions have been listed from the most common and well-known solutions to the more obscure solutions.  Hopefully one of the more common solutions will work for you.

Solution 1: Unblock the file

The most common solution to this error is to simply Unblock the file.  When you download a file from a network location, Windows marks it as blocked and you have to explicitly unblock it.

  1. Right-click the offending file and go to Properties.
  2. Click on the Unblock button or checkbox at the bottom of the dialog.

  3. Click OK to save your changes and see if it helps.

Tip: Unblock multiple files at once

If you have quite a few offending files, you can run a Powershell command in the directory with all the offending files to unblock all of them at once.

To do this, open Powershell and run the following command:

Get-ChildItem -Path '{PATH_TO_DIRECTORY_CONTAINING_OFFENDING_FILES}' -Recurse | Unblock-File

This should unblock all the files in the directory as well as in any sub-directories.

Solution 2: Make sure the file isn't being synchronised by any online storage service

If you are running OneDrive or Google Drive Syn on your computer, make sure the file is not being synchronised by any of these services.  When these services upload and download files, the files can get the Mark of the Web preventing you from being able to build with them.

If this is the case, copy the files to a directory that is not being synchronised and then unblock all the files as shown in Solution 1.

Solution 3: Recreate the offending file

If a file has the Mark of the Web after being downloaded, you can create a new file with exactly the same name and then copy the contents of the downloaded file to the new file.

  1. Rename the file you downloaded and add something like _old to the end of the filename so you can create the new file.
  2. Create a new file by right-clicking in the folder and selecting New -> Text Document.
  3. Rename the text document to the old filename (make sure you change the extension as well to the appropriate file extension).
  4. Open the old file and your newly-created file and copy the contents from the old file to the new file and save it.

This solution is a bit messy but it does work in some cases.

Solution 4: Delete the db.lock file in the solution folder

Another solution is to delete the db.lock file that exists in the .vs folder in your solution folder. This one's a bit of black magic, but it has reportedly fixed the issue for some people.

  1. Close Visual Studio IDE
  2. Make sure you can view hidden items in Windows Explorer

  3. Navigate to the solution folder and then open the .vs folder.
  4. Navigate to {PROJECT/FILE NAME}/v15/Server/sqlite3.
  5. Delete the db.lock file.
  6. Open the solution again and try rebuild.

Solution 5: Clean the project and rebuild it

Sometimes you need to clean the project before rebuilding it in order to resolve the error.  Cleaning the solution removes and residual files that remain after previous builds.  This gives you a clean slate to build the project on.

  1. Right-click on the project in Visual Studio
  2. Click on Clean

  3. Rebuild the solution once the clean is done.


Hopefully one of these solutions solved your problem.  This problem can be the cause of many headaches.

Astech cannot take responsibility for any damage or loss of files that occur while trying the above solutions.  Please make backups of your files and be aware of the consequences of any actions you take.


Sage 300 CRM