EndangeredMassa
EndangeredMassa

Reputation: 17528

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

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

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

Upvotes: 1

Views: 3444

Answers (3)

kerryking
kerryking

Reputation: 104

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.

Upvotes: 0

EndangeredMassa
EndangeredMassa

Reputation: 17528

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.

Upvotes: 0

Josh E
Josh E

Reputation: 7424

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.

Upvotes: 1

Related Questions