aspnet_compiler ASPParse Could Not Load Type
Asked Answered
A

8

17

I am unable to build my Web Application (not Web Site) in our build environement. We use DMAKE in our build environment (this unfortunately is non negotiable, therefore using MSBUILD is not permitted ) and when invoking the asp.net precompiler through

C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -d -nologo -p Site -f -fixednames -errorstack -v / Debug

We get the following error

error ASPPARSE: Could not load type 'X.Y.Admin.Site.Global

If I compile from the ide it is successful. If i then compile with aspnet_compilier it is successful. So i only get a successful compile with aspnet_compiler when the target dll i am trying to compile is in the bin of the web application i am compiling.

I keep running into postings that talk about solutions using MSBUILD which unfortunately I cant try.

Any help would be appreciated

Alvar answered 21/11, 2008 at 21:34 Comment(0)
C
15

We had the same problem on our web application: error ASPPARSE: Could not load type '...'

The problem was that we had the file on disk (on the project folder) but it wasn't included in our application project (in the .csproj file). We solved the problem by including the file in the project :)

Claim answered 17/12, 2009 at 11:53 Comment(1)
Alternately, I solved this by deleting those old files off my hard drive, since in my case they were no longer referenced by the project because we didn't want them.Xylidine
E
4

I ran into a similar problem using NANT. The trick was to compile the web applications code files into a dll then include that when using aspnet_compiler.

use the command line compiler,either csc.exe (c#) or vbc.exe (visual basic), to compile your web application with an output of type library. This will create a dll that you can use in your aspnet_compiler task

Elburt answered 23/7, 2009 at 21:17 Comment(3)
I was under the mistaken impression that aspnet_compiler also compiled the web application and created the dll. (the words asp and compiler made me think this!)Unity
+1 for this answer, it worked for me as well (thank goodness!). What on earth did we do before StackOverflow? :-)Dougherty
@gerrod, I'm dating myself and maybe your question was rhetorical, but we had Google Groups, and before that we had Bulletin Boards and Forums and UseNet. It was great, because no one was rated (it was mainly just peer pressure), but that was in the good ole days when there were a lot less people programming. :) Don't get me wrong, SO has its good points.Subliminal
R
2

Have you tried specifying the path using -p? Sounds to me like it can't find that type / assembly.

http://msdn.microsoft.com/en-us/library/ms229863(VS.80).aspx

Rosie answered 13/12, 2008 at 19:20 Comment(0)
C
1

For web applications, you have to build the .vb files into a dll and put that in the bin folder before you run the aspnet compiler. Check the output window in visual studio and you'll see the command line for the VB compiler. Run that first before you run the aspnet compiler, and the asp pages should be able to find the missing types.

Chaulmoogra answered 22/7, 2009 at 18:58 Comment(0)
T
1

This problem was resolved for me by simply deleting all bin and obj folders. Seems like they were in a bad state somehow. I also deleted the the .sou file, but I don't think that was the issue.

Topfull answered 31/5, 2016 at 14:59 Comment(0)
T
0

I received the same problem.

I fixed it by copying my webapp's DLL from the OBJ/DEBUG folder to the BIN folder.

Townie answered 12/11, 2009 at 1:34 Comment(0)
W
0

I just had this error and found 2 ways to fix it, either:

  • Change the Codebehind attribute in the global.asax file to CodeFile and add "partial" to the class declaration
  • In the deployment project's property pages, set "Version output assemblies" and provide a version number

I don't really know why either worked, but it did.

Winthrop answered 25/3, 2013 at 16:33 Comment(0)
H
0

solution :

-p Site path must have the directory path of .csproj file location.

ex :-

aspnet_compiler -p D:\Projects\MGM\mgm\mgm -v / D:\Projects\MGM-deploy\mgm_compiled
Hudak answered 22/10, 2013 at 8:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.