I am building a new VM for Development. In my Production environment I have a page that throws no errors and works correctly. However, when I try to look at this page in the new VM, I get the error "Type is undefined" in reference to this line: Type.registerNamespace('SP')
I found this articles saying to add the following script will fix the problem but it does not work for me.
The following is a page that works in Prod but not in my new VM.
<%@ Page language="C#" MasterPageFile="~masterurl/default.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=15.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
<SharePoint:ScriptLink Name="SP.UI.Dialog.js" runat="server" />
</asp:Content>
<input id="Splash_btn" onclick="SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK,true)" type="button" value="I AGREE"/>
</asp:Content>
The line that causes the error is:
<SharePoint:ScriptLink Name="SP.UI.Dialog.js" runat="server" />
If I remove this line, the SP.UI.ModalDialog code does not work. It seems odd that I have to explicitly call SP.UI.Dialog.js but it works in Prod. Any idea how to resolve the error with my new VM?