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.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() EAI.RosettaNet.4B2.
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!
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.
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.
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).