开发者

Problems using aspnet_compiler to compile a fresh ASP.NET MVC 3 project

开发者 https://www.devze.com 2023-02-18 22:34 出处:网络
I recently updated a project in my solution to use MVC 3 instead of MVC 2. Ever since doing that, and although it开发者_如何学Python compiles in my machine, I get the following error in the server:

I recently updated a project in my solution to use MVC 3 instead of MVC 2.

Ever since doing that, and although it开发者_如何学Python compiles in my machine, I get the following error in the server:

/MyProject.csproj/global.asax (1,0):

    errorASPPARSE: Could not load type 'MyNamespace.MvcApplication'.

Any ideas?

  • It compiles and works ok in my machine.
  • It compiles in the server if I open it in a VS.NET 2010.
  • It compiles in the server via msbuild.

UPDATE: The exact command that fails is this:

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /MyProject.csproj -p c:\cruisecontrol\trunk.project\checkout\Solution\Project -u -f .\TempBuildDir\ 

If I open the VS.NET 2010 in the server, compile it once manually, the command then runs ok.

The problem is that my CC.NET deletes everything and then checks it out from source control from scratch, so this approach doesn't work for me. Although it's interesting because it's weird.

UPDATE 2: I was able to reproduce this locally, so it's not a problem specifically in the CC.NET server.

Could someone try to reproduce it?

MVC 3 application with razor (although I doubt it'd make a difference), run aspnet_compiler on it, and see if it fails with that error. Just close VS.NET as soon as it creates the solution and the project.

Problems using aspnet_compiler to compile a fresh ASP.NET MVC 3 project

This does not happen if I compile it at least once with Visual Studio

If someone is kind enough to try it, I can rule out a problem in the 2 machines I tested.


Apparently aspnet_compiler.exe required that the /bin directory exists, that's why building it once with vs.net fixes the consecutive compilations using aspnet_compiler.exe.

I don't know why this worked before changing my application from mvc 2 to mvc 3, but I fixed it by changing a property in the .wdproj file

From

<SourceWebPhysicalPath>..\..\Project\</SourceWebPhysicalPath>

To

<SourceWebPhysicalPath>..\..\Project\bin</SourceWebPhysicalPath>

Source

0

精彩评论

暂无评论...
验证码 换一张
取 消