【发布时间】:2017-06-11 05:10:03
【问题描述】:
我最近从我的公司获得了 html 和资产,用于他们的网络标准。我有一个现有的 asp.net Web 应用程序,我使用 Visual Studio 2015 中的默认模板创建。我正在尴尬地查看是否可以将这些更改应用到 Site.Master,以及我尝试的第一件事做的是通过 asp:ScriptReference 添加 javascript 文件,如下所示。
<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>
我不确定框架脚本和站点脚本有何不同,但我添加的那些在站点脚本下。
我还确保将 .js 文件复制到它们应该位于的脚本文件夹中,所以路径都是正确的。
但是,当我在浏览器中发布和打开我的应用程序时出现以下错误
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.
这会将我带到对我来说毫无意义的 AssemblyInfo.cs 文件。它只包含以下内容:
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")]
以及似乎定义了dependantAssembly信息的Web.Config文件之类的。
我似乎已经脱离了我的元素,这是我第一次接触到在 asp.net 中使用 Web 应用程序。我已经设法弄清楚如何在设计视图中开始工作,并且已经成功地完成了很多我想用 c# 代码隐藏在功能上做的事情。然而,当谈到 AssemblyInfo 和 Web.Config 时,考虑到我对 Web 前端的参考框架是 html、jquery 和一些 css,它们是什么以及如何使用它们并没有多大意义。
至少有人可以指导我如何成功添加更多脚本,也许还有如何成功应用 css 和其他有用的技巧来调整应用程序模板的外观?提前非常感谢。
【问题讨论】:
标签: javascript asp.net web-applications assemblyinfo master-pages