One of the development environment for developing BizTalk Server 2006 solutions I worked on had Windows XP and Visual Studio 2005 running on it. The environment was quite complicated with scripts and Domain Controller Policies executing each time you would log on the machine. Moreover, I think that the C:\Documents and Settings directory was mapped to some network resource as the directory would become inaccessible when network problems occurred.
Anyhow, one day while compiling a BizTalk solution in Visual Studio, I had the following error:
Cryptographic failure while signing assembly ‘MyAssemblyName’ Access is denied.
The cause was that I had lost access rights in the following directory: C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys. I don’t know why I had lost access rights but it was probably due to one of those unusual scripts/policies loaded at startup… and I never had such error on any other environments. After giving myself full access rights on that folder, the BizTalk solution would compile without error.
In the following screenshot I gave full access right to “Everyone” for simplicity sake as more than one user needed the access rights.
Conclusion:
The underlying reason for the compilation error is that because BizTalk libraries are deployed to the GAC, they must be signed with a strong name key file. As the signing process uses the C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys folder, the assembly could not be signed without being able to access the folder and the compilation would faild. Once I fixed the access rights, the assembly could be signed and Visual Studio could compile the BizTalk solution successfully.
This means that this error can happen any time the folder is needed such as in the following scenarios:
- Compiling a Visual Studio project which assembly is signed.
- Compiling a project or solution containing strongly signed assemblies through msbuild and/or TFS.
- Generating a strong name key file with Visual Studio or with the utility sn.exe