4

I have recently gotten html and assets from my company for their web standards. I have an existing asp.net web application I've created using the default template in Visual Studio 2015. I'm awkwardly working through to see if I can apply these changes to Site.Master, and the first thing I'm trying to do is add the javascript files through asp:ScriptReference as follows.

<asp:ScriptManager ID="ScriptManager" runat="server">
        <Scripts>
            <%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=301884 --%>
            <%--Framework Scripts--%>
            <asp:ScriptReference Name="MsAjaxBundle" />
            <asp:ScriptReference Name="jquery" />
            <asp:ScriptReference Name="bootstrap" />
            <asp:ScriptReference Name="respond" />
            <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
            <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
            <asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
            <asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
            <asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
            <asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
            <asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
            <asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
            <asp:ScriptReference Name="WebFormsBundle" />
            <%--Site Scripts--%>
            <asp:ScriptReference Name="angular.min.js" Path="~/Scripts/angular.min.js"/>
            <asp:ScriptReference Name="default.min.js" Path="~/Scripts/default.min.js"/>
            <asp:ScriptReference Name="forms.js" Path="~/Scripts/forms.js"/>
            <asp:ScriptReference Name="libraries.js" Path="~/Scripts/libraries.js"/>
        </Scripts>
    </asp:ScriptManager>

I'm not sure how framework scripts and site scripts differ, but the ones I added are under Site Scripts.

I have also made sure to copy the .js files into the scripts folder where they are supposed to be located, so the paths are all correct.

However I am getting the following error when I publish and open my app in a browser

The assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not contain a Web resource that has the name 'angular.min.js'. Make sure that the resource name is spelled correctly.

This takes me to the AssemblyInfo.cs file that makes no sense to me. It only contains the following:

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebApplication")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebApplication")]
[assembly: AssemblyCopyright("Copyright ©  2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e0ca37b5-d082-45bf-a409-4d03cd60fc61")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Revision and Build Numbers 
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

As well as the Web.Config file where the dependantAssembly information seems to be defined or something.

I seem to be way out of my element here, this is my first exposure to working with web apps in asp.net. I've managed to figure out as I go along how to get things started in design view, and have managed to accomplish a lot of what I want to do functionally with the c# codebehind. However when it comes to AssemblyInfo and Web.Config, what they are and how to use them doesn't make a heck of a lot of sense given that my frame of reference with web front ends was html, jquery and some css.

Can someone walk me through at the very least how to successfully add more scripts, and maybe also how to successfully apply css and other helpful tips to adjusting the look of the app template? Thanks so much in advance.

David
  • 573
  • 7
  • 40

1 Answers1

0

Adding javascript resources under

<%--Site Scripts--%>

within the ScriptManager block is the convention that should be used for your information only.

Unless you are using the ScriptResourceMapping property of the ScriptManager in a ScriptResourceDefinition, the "Name" tag should be left blank.

These should work instead:

<%--Site Scripts--%>
<asp:ScriptReference Path="~/Scripts/angular.min.js"/>
<asp:ScriptReference Path="~/Scripts/default.min.js"/>
<asp:ScriptReference Path="~/Scripts/forms.js"/>
<asp:ScriptReference Path="~/Scripts/libraries.js"/>

Notice I have removed "Name" and included "Path" only.

Walker
  • 11
  • 4