Visual Studio 2013 refuses to build solution, says "Could not load file or assembly ... Failed to grant minimum permission requests", 0x80131417

3

I have a VS solution that used to build fine. It's been building fine for like forever in VS 2010, and built fine until I made some modifications to a project that pulls in a third-party library (in this case, ActiveReports3) at which point I can no longer build the solution successfully. Instead, I get the following error (where XX is the name of the project in question):

File: LC
Line:
Column:
Project: XX
Description: 'Could not load file or assembly 'ActiveReports3, Version=5.3.1436.2, Culture=neutral, PublicKeyToken=cc4967777c49a3ff' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)'

Note that this is not an exception during execution; it is a build-time error, preventing the build from completing successfully.

Most of what I can find by googling indicates that I should use the .NET Framework Configuration tool to create a CAS policy. That was also my own first guess. However, it looks like that was retired with the introduction of .NET 4, and it's nowhere to be found on my Windows 8.1 development machine despite the legacy versions of .NET showing as installed in Add/remove Windows features. Many of the pages and posts I have found are also on the order of 5+ years old.

MSDN indicates I should be able to add a bit to my web.config to set the trust level. However, I tried adding as:

<configuration>
  <system.web>
    <trust legacyCasModel="True" level="Full"/>  <-- this line is what I really added
  </system.web>
</configuration>

but this doesn't seem to have changed anything. Interestingly, Visual Studio doesn't like the legacyCasModel="True" part, and complains that "the 'legacyCasModel' attribute is not allowed". It does not seem to be causing an actual error, however.

All I did between when the solution built and when it didn't was duplicate some C# source code files and fix them up so I didn't get syntax errors (things like duplicate class names).

I'm pulling my hair out over this. Shelving the changes and rebuilding succeeds. Unshelving the changes causes the build to fail again. Looking at the shelveset, I see nothing obviously wrong. How do I fix this error without changing the environment?

The assembly in question is stored on a UNC network share.

I have checked the project .NET version and it is set to .NET Framework 2.0.

I have tried setting the build action on all the freshly added files to "None", but that doesn't seem to have changed anything for the better.

I have tried adding a CAS policy using both the .NET 2.0 and 4.0 caspol.exe and both return an error message simply stating ERROR: Unable to load assembly. I have verified that I am able to open the assembly DLL in its origin location using Notepad++.

asp.net
visual-studio-2013
windows-8.1
cas
activereports
asked on Stack Overflow Sep 8, 2014 by user • edited Sep 8, 2014 by user

1 Answer

0

Turns out the ultimate culprit was a properties file in the project which contained only some text, but which had the Build Action property field set to Embedded Resource. I still don't really understand exactly which action caused this property to apparently be set wrong.

Changing the build action property field for that file to None appears to have resolved the issue with no ill side effects.

So, it looks like in the end, the important part to the error message was the assembly specifier, and the "failed to grant minimum permission requests" was really a false lead. Hence, check your non-source-code project files' build action property to make sure they are set correctly.

answered on Stack Overflow Sep 9, 2014 by user • edited Sep 11, 2014 by user

User contributions licensed under CC BY-SA 3.0