0

I want to reference a class library method inside the application aspx page but I keep getting the dreaded Yellow Screen of Death with the error message

CS0103: The name 'Common' does not exist in the current context.

I followed the steps mentioned here to add the project to GAC and I also restarted IIS via IIS Manager.

Here's my application page:

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ApplicationPage1.aspx.cs" Inherits="SharePointProject1.Layouts.SharePointProject1.ApplicationPage1" DynamicMasterPageFile="~masterurl/default.master" %>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">

</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<asp:Label ID="lblTest" runat="server" />
<%= Common.Lib.Utility.GetStatusImage("approved") %>
</asp:Content>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
Application Page
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
My Application Page
</asp:Content>
Community
  • 1
  • 1
Raihan Iqbal
  • 407
  • 3
  • 16
  • can you see the assembly where Common class is located in the GAC? you need to look at v2.0 gac as SharePoint2010 is still based on 3.5 .Net version.
    To ensure that it's in the gac you can bring gacutil.exe from sdk tools and run `gacutil /l <>`
    – Roman May 26 '12 at 04:06
  • If not, then you may have an assembly that does not have a strong name and thus cannot be GAC'd – Roman May 26 '12 at 04:09
  • Yes its strongly signed. I strongly signed my library project from Properties -> Signing – Raihan Iqbal May 26 '12 at 06:14
  • i just realized that i do not see the Namespace registration in your markup code. – Roman May 26 '12 at 20:51

0 Answers0