BizTalk Visual Studio Deploy Issue: The “MapperCompiler” task failed unexpectedly. Access to the path ‘…’ is denied

Back to one of my favorite topics: Errors and Warnings, Causes, and Solutions since I have several issues to report in my internal OneNote. But in fact, this one happened today while I was implementing a new RosettaNet PIP on a client… nevertheless, this is not specific to RosettaNet.

I was making a small improvement to an existing process/project to allow specific orchestrations to be activated based on some properties promoted from the message by applying a filter on the activate Receive Message shape. Everything was going peacefully well until I tried to redeploy the Visual Studio solution. Once I try to redeploy the BizTalk Server Visual Studio solution from Visual Studio, I got the following error:

Error The “MapperCompiler” task failed unexpectedly.

System.UnauthorizedAccessException: Access to the path ‘C:\…\…\Maps\mapNotifyOfShipmentReceipt_To_PIP4B2.btm.cs’ is denied.

   at Microsoft.VisualStudio.BizTalkProject.Compiler.MapCompiler.Compile(BizTalkBuildSnapshot buildSnapshot, IEnumerable`1 mapFilesToCompile, IEnumerable`1 schemaFiles, List`1& generatedCodeFiles, List`1& xsltFiles)

   at Microsoft.VisualStudio.BizTalkProject.BuildTasks.MapperCompiler.Execute()

   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()

   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() EAI.RosettaNet.4B2.

BizTalk Server: The MapperCompiler task failed unexpectedly

The funny part was that this was a small change that I did in an existing solution that already was running fine in the environment… and the change was a small improvement in the orchestration, not on the map!

Cause

Well, I don’t know why the compiler decided to pick the mapper to complain. But This issue is not related to any kind of maps you may have in your solution.

And yes, the user that I was using to open, and build the solution had full rights to access the file in question, all full rights to deploy stuff to the BizTalk Server environment.

There are several possible causes for you to get such Access Denied errors when deploying BizTalk solutions directly from Visual Studio. Most common is that you don’t have the right BizTalk privileges to deploy artifacts, or in other words, you are not a local Administrator.

But most of the time is simpler than that and indeed is related to additional securities setting present in recent Windows Server versions. For you to be able to successfully deploy a BizTalk Server solution directly from Visual Studio, you must run Visual Studio as an Administrator, or with elevated permissions, because BizTalk assemblies need to be deployed into the GAC. What normally happens, is that if you have User Account Control (UAC) activated, or sometimes even deactivated, there are some additional securities setting present in recent Windows Server versions that, by default, doesn’t run Visual Studio with elevated permissions.

This was indeed one of these cases, Visual Studio was not open with elevated permissions.

Solution

The quick solution is for you to run Visual Studio as an Administrator by simply run below step:

  • Right-click under Visual Studio and choose Run as administrator option.
Visual Studio: Run as Administrator

The problem with this approach is that you need to remember yourself to do it every time you want to run Visual Studio. Otherwise, the next time you try to deploy the solution, it will fail again with the same error.

You may find more how to configure Visual Studio to run with elevated permissions as administrator by default here: https://blogs.biztalk360.com/biztalk-server-tips-and-tricks-configure-visual-studio-to-run-with-elevated-permissions-as-administrator/

If you try now to deploy your solution, you will see that this problem goes aways and you will be able to deploy it successfully (assuming that the solution does not actually have errors).

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *

BizTalk360
BizTalk Server

Over 500+ customers across
30+ countries depend on BizTalk360

Learn More
Serverless360
Azure

Manage and monitor serverless
components effortlessly

Learn More
Atomicscope
Business Users

Monitor your Business Activity in iPaaS
or Hybrid integration solutions

Learn More

Back to Top