MSBUILD: Publish Error

I have been able to build and publish without any problems in VS 2010 using MSBuild. Since this morning for reasons unforeseen I am getting the following error:

"ASPNETCOMPILER: error ASPCONFIG: Could not load file or assembly 'mscorcfg' or one of its dependencies. An attempt was made to load a program with an incorrect format."

The strange thing is I can build and publish normally when I take out the step to publish the web application after build. But when I put this back I notice that it builds fine but breaks on compiling at the publishwebsite target.