2
votes

Is it allowed to put System.Web.Mvc in the GAC? Allowed as in: does it work?

I have done this and all my projects have problems inheriting from System.Web.Mvc.ViewPage...

EDIT Hope this doesn't scare you:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE> "c:\WINDOWS\Microsoft.NET\Framework\v3.5\vbc.exe" /t:library /utf8output /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\56b70440\003d6f34_8989c901\EntitySpaces.SqlServerCeProvider.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Abstractions\3.5.0.0__31bf3856ad364e35\System.Web.Abstractions.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\3.5.0.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\de7cc3b4\0097d136_8989c901\EntitySpaces.LoaderMT.DLL" /R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\2afa6c79\006aa035_8989c901\EntitySpaces.NpgsqlProvider.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\4a9a547a\006aa035_8989c901\EntitySpaces.OracleClientProvider.DLL" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\ea5276d6\0051153a_699ec901\System.Web.Mvc.DLL" /R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\f8843c3a\0097d136_8989c901\EntitySpaces.Web.Design.DLL" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\4137948d\003d6f34_8989c901\EntitySpaces.Npgsql2Provider.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\b72019d9\003d6f34_8989c901\EntitySpaces.MySqlClientProvider.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Data.DataSetExtensions\3.5.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_global.asax.hiqvxvcm.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Data.Linq\3.5.0.0__b77a5c561934e089\System.Data.Linq.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\ad4567e4\006aa035_8989c901\EntitySpaces.Loader.DLL" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\b543038f\006aa035_8989c901\EntitySpaces.Core.DLL" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\701637c6\003d6f34_8989c901\EntitySpaces.VistaDBProvider.DLL" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_vpbbzwke.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\66dcb3ba\006aa035_8989c901\EntitySpaces.Web.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Routing\3.5.0.0__31bf3856ad364e35\System.Web.Routing.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\EC\1.0.0.0__2fce90138e5217ab\EC.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\750052d7\716d39b6_bfd3c901\VandaagLijst.DLL" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\d5308498\003d6f34_8989c901\EntitySpaces.MSAccessProvider.DLL" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\5ad7a5b5\006aa035_8989c901\EntitySpaces.SqlClientProvider.DLL" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\assembly\dl3\54566418\003d6f34_8989c901\EntitySpaces.Interfaces.DLL" /out:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.dll" /debug- /win32resource:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\p7uswgud.res" /define:_MYTYPE=\"Web\" /imports:Microsoft.VisualBasic,System,System.Collections,System.Collections.Specialized,System.Configuration,System.Text,System.Text.RegularExpressions,System.Web,System.Web.Caching,System.Web.SessionState,System.Web.Security,System.Web.Profile,System.Web.UI,System.Web.UI.WebControls,System.Web.UI.WebControls.WebParts,System.Web.UI.HtmlControls,System.Web.Mvc,System.Web.Mvc.Ajax,System.Web.Mvc.Html,System.Web.Routing,System.Linq,System.Collections.Generic,EC /warnaserror- /optionInfer+  "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.0.vb" "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.1.vb" "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.2.vb" "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.3.vb"

Microsoft (R) Visual Basic Compiler version 9.0.30729.1 Copyright (c) Microsoft Corporation. All rights reserved.

C:\Bugging\VandaagLijst\VandaagLijst\Views\home\List.aspx(1) : error BC30456: 'Title' is not a member of 'ASP.views_home_list_aspx'.

        __ctrl.Title = ""
        ~~~~~~~~~~~~     

C:\Bugging\VandaagLijst\VandaagLijst\Views\home\List.aspx(1) : error BC30456: 'InitializeCulture' is not a member of 'ASP.views_home_list_aspx'.

        Me.InitializeCulture
        ~~~~~~~~~~~~~~~~~~~~

C:\Bugging\VandaagLijst\VandaagLijst\Views\home\List.aspx(1) : error BC30456: 'MasterPageFile' is not a member of 'ASP.views_home_list_aspx'.

        __ctrl.MasterPageFile = "~/Views/Shared/Site.Master"
        ~~~~~~~~~~~~~~~~~~~~~                               

C:\Bugging\VandaagLijst\VandaagLijst\Views\home\List.aspx(7) : error BC30456: 'AddContentTemplate' is not a member of 'ASP.views_home_list_aspx'.

        Me.AddContentTemplate("TitleContent", New System.Web.UI.CompiledTemplateBuilder(AddressOf Me.__BuildControlContent1))
        ~~~~~~~~~~~~~~~~~~~~~                                                                                                

C:\Bugging\VandaagLijst\VandaagLijst\Views\home\List.aspx(11) : error BC30456: 'AddContentTemplate' is not a member of 'ASP.views_home_list_aspx'.

        Me.AddContentTemplate("MainContent", New System.Web.UI.CompiledTemplateBuilder(AddressOf Me.__BuildControlContent2))
        ~~~~~~~~~~~~~~~~~~~~~                                                                                               

C:\Bugging\VandaagLijst\VandaagLijst\Views\home\List.aspx(13) : error BC30451: Name 'Model' is not declared.

       For Each item In Model
                        ~~~~~

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.2.vb(42) : error BC30198: ')' expected.

    Inherits System.Web.Mvc.ViewPage(of IEnumerable(of Models.TestClass)
                                                                       ~

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.2.vb(43) : error BC30154: Class 'views_home_list_aspx' must implement 'ReadOnly Property IsReusable() As Boolean' for interface 'System.Web.IHttpHandler'. Implementing property must have matching 'ReadOnly' or 'WriteOnly' specifiers.

    Implements System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler
                                                              ~~~~~~~~~~~~~~~~~~~~~~~

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.2.vb(43) : error BC30149: Class 'views_home_list_aspx' must implement 'Sub ProcessRequest(context As HttpContext)' for interface 'System.Web.IHttpHandler'.

    Implements System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler
                                                              ~~~~~~~~~~~~~~~~~~~~~~~

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.2.vb(55) : error BC30311: Value of type 'ASP.views_home_list_aspx' cannot be converted to 'System.Web.Mvc.ViewPage'.

        CType(Me,Global.System.Web.Mvc.ViewPage).AppRelativeVirtualPath = "~/Views/home/List.aspx"
              ~~                                                                                  

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.2.vb(57) : error BC30456: 'ReadStringResource' is not a member of 'ASP.views_home_list_aspx'.

            Global.ASP.views_home_list_aspx.__stringResource = Me.ReadStringResource
                                                               ~~~~~~~~~~~~~~~~~~~~~

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.2.vb(61) : error BC30456: 'GetWrappedFileDependencies' is not a member of 'ASP.views_home_list_aspx'.

            Global.ASP.views_home_list_aspx.__fileDependencies = Me.GetWrappedFileDependencies(dependencies)
                                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~              

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.2.vb(68) : error BC30456: 'Context' is not a member of 'ASP.views_home_list_aspx'.

            Return CType(Me.Context.Profile,System.Web.Profile.DefaultProfile)
                         ~~~~~~~~~~                                           

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.2.vb(74) : error BC30456: 'Context' is not a member of 'ASP.views_home_list_aspx'.

            Return CType(Me.Context.ApplicationInstance,ASP.global_asax)
                         ~~~~~~~~~~                                     

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.2.vb(193) : error BC30284: sub 'FrameworkInitialize' cannot be declared 'Overrides' because it does not override a sub in a base class.

    Protected Overrides Sub FrameworkInitialize()
                            ~~~~~~~~~~~~~~~~~~~  

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.2.vb(195) : error BC30456: 'SetStringResourcePointer' is not a member of 'ASP.views_home_list_aspx'.

        Me.SetStringResourcePointer(Global.ASP.views_home_list_aspx.__stringResource, 0)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                     

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.2.vb(197) : error BC30456: 'AddWrappedFileDependencies' is not a member of 'ASP.views_home_list_aspx'.

        Me.AddWrappedFileDependencies(Global.ASP.views_home_list_aspx.__fileDependencies)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                    

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.2.vb(201) : error BC30284: function 'GetTypeHashCode' cannot be declared 'Overrides' because it does not override a function in a base class.

    Public Overrides Function GetTypeHashCode() As Integer
                              ~~~~~~~~~~~~~~~             

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\24f69041\8efa8a35\App_Web_p7uswgud.2.vb(206) : error BC30284: sub 'ProcessRequest' cannot be declared 'Overrides' because it does not override a sub in a base class.

    Public Overrides Sub ProcessRequest(ByVal context As System.Web.HttpContext)
                         ~~~~~~~~~~~~~~             
1
perhaps some more context around the problem you're having would help. Can you not find ViewPage? Does it compile? Does it fail at runtime?Martin Peck
I can compile. At runtime it says: Title is not a member of ASP.views_index_aspx. I can however not find the class views_index_aspx. I have reason to believe that this is generated in the background. However in the wrong namespace i guess (ASP), which should be (MyProject) right?Ropstah

1 Answers

2
votes

It works at runtime. You still need to have a referenced assembly. How are you referencing the assemblies for your build/VS.NET environment?

As you can see from here...

http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx

... the default is to install these assemblies into the GAC and you have to explicity work around this if you want to bin-deploy your MVC assemblies (for example, in a shared hosting situation).