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

F.A.B
  • 181
  • 1
  • 1
  • 3

8 Answers8

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 :)

Costin
  • 770
  • 7
  • 19
  • 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. – Keiki Aug 06 '18 at 13:22
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

  • 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!) – AndyM Feb 24 '10 at 12:48
  • +1 for this answer, it worked for me as well (thank goodness!). What on earth did we do before StackOverflow? :-) – gerrod Jun 17 '10 at 10:47
  • @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. – clairestreb Oct 10 '16 at 22:04
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

pbz
  • 8,865
  • 14
  • 56
  • 70
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.

Sean McMillan
  • 10,058
  • 6
  • 55
  • 65
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.

dmathisen
  • 2,269
  • 3
  • 36
  • 63
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.

Nick
  • 301
  • 2
  • 4
0

I received the same problem.

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

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
kleopatra
  • 51,061
  • 28
  • 99
  • 211