Has anyone encountered: "Could not load file or assembly 'aspnet_compiler... Failed to grant permission to execute"?

1

I am encountering a strange build issue in .NET 3.5. The compiler is crashing when it attempts to build a Web Deployment Project.

C:\Program Files\MSBuild\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets(531,9): error MSB6006: "aspnet_compiler.exe" exited with code -532459699.

Which leads to:

Could not load file or assembly 'aspnet_compiler, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)

That section of Microsoft.WebDeployment.targets is this:

<AspNetCompiler 
      PhysicalPath="$(_AspNetCompilerSourceWebPath)"
      TargetPath="$(TempBuildDir)"
      VirtualPath="$(_AspNetCompilerVirtualPath)"
      Force="$(_Force)"
      Debug="$(DebugSymbols)"
      Updateable="$(EnableUpdateable)" 
      KeyFile="$(_FullKeyFile)" 
      KeyContainer="$(_AspNetCompilerKeyContainer)"
      DelaySign="$(DelaySign)" 
      AllowPartiallyTrustedCallers="$(AllowPartiallyTrustedCallers)" 
      FixedNames="$(_AspNetCompilerFixedNames)" 
      Clean="$(Clean)"
      MetabasePath="$(_AspNetCompilerMetabasePath)"
/>

If I try:

aspnet_compiler.exe -errorstack -v /MyProject -p C:\MyProject -f -c -d .\TempBuildDir\

I get:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'aspnet_compiler, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)

File name: 'aspnet_compiler, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.Security.XmlSyntaxException: Invalid syntax.

I could build fine until I made a small code change. I've reverted the change, but I continue to encounter this error. Other team members can build the exact same source.

Things I've Tried

  • Reinstalling VS
  • Reinstalling Web Deployment Projects addin
  • Restarting
  • Building with nant
  • Building in VS
  • Building from the command line with aspnet_compiler.exe

Has anyone encountered this type of error before? My next step is to reformat, unless I can find something else to try.

.net
compiler-construction
nant
asked on Stack Overflow Jun 4, 2009 by EndangeredMassa • edited Jun 20, 2020 by Community

3 Answers

1

Try clearing out your [Windows folder]\Microsoft .NET\Framework\2.0xxx\Temporary ASP.NET Files*.* folder - that can sometimes get gummed up with GB's of temp files. Also, check to see if your website is using Impersonation or an alternate security account. If it is, then make sure that you grant write and execute perms for the aforementioned folder to the impersonated account.

answered on Stack Overflow Jun 4, 2009 by Josh E
0

I was finally able to build after running a full build in nant with:

nant build

I thought I tried this before. Anyway, it works now--no thanks to the error message. I imagine that my nant config for MyProject is missing a dependency, or something.

answered on Stack Overflow Jun 4, 2009 by EndangeredMassa
0

I met the same problem for another reason. I impersonate another user in my web.config file ,this is not right to access some dir,remove this config is fixed.

answered on Stack Overflow Jul 19, 2012 by kerryking

User contributions licensed under CC BY-SA 3.0