4

I am running aspnet_compiler as a post-build event, using the following command:

aspnet_compiler.exe -v / -p \

I am getting this error on compile:

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

I have read several other StackOverflows about this, and tried the following:

  1. Looked for stray web.config files -- there are none, except the two that come standard in an MVC app (in the main MVC directory and in the Views directory).
  2. Added the application in IIS. This didn't make a difference.
  3. Tried running with IIS Express instead of the development server -- no difference.

Any thoughts on what could be causing this?

awright
  • 1,224
  • 1
  • 13
  • 23

1 Answers1

1

I think this is actually a Visual Studio bug. When I've seen this error I usually:

  • Close Visual Studio.
  • Delete the bin and obj folders of the project.
  • Delete any other folder that might have a stray web.config (e.g. a backup sub-folder inside the project.)
  • Launch Visual Studio.
  • Open the solution and compile it again.
Hector Correa
  • 26,290
  • 8
  • 57
  • 73