andrewdavey / andrewdavey/cassette

Resources duplication causes error on application startup

Đang mở
#249 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
Bug
Ngôn ngữ chính
C#
Star
531
Fork
139
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hey Andrew,

In this last version 1.2.1, a single Bundles.Reference causes the following error when trying to load the application. But I think that the problem is on the configuration of the Cassette.

I am sending the error message

```
Server Error in '/Atual' Application.
A StylesheetBundle with the path "~/Content/css/accordion.css" has already been added to the collection.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: A StylesheetBundle with the path "~/Content/css/accordion.css" has already been added to the collection.

Source Error:

Line 19: // In production the content will be minified, but the files are not combined.
Line 20: // So you probably want to tweak these defaults!
Line 21: bundles.AddPerIndividualFile("Content");
Line 22: bundles.AddPerIndividualFile("Scripts");
Line 23:

Source File: F:\Projetos\SisImob\Server\Atual\CassetteConfiguration.cs Line: 21

Stack Trace:

[ArgumentException: A StylesheetBundle with the path "~/Content/css/accordion.css" has already been added to the collection.]
Cassette.Configuration.BundleCollection.Add(Bundle bundle) +174
Cassette.Configuration.BundleCollectionExtensions.AddPerIndividualFile(BundleCollection bundleCollection, String directoryPath, IFileSearch fileSearch, Action`1 customizeBundle) +428
Atual.WebSite.CassetteConfiguration.Configure(BundleCollection bundles, CassetteSettings settings) in F:\Projetos\SisImob\Server\Atual\CassetteConfiguration.cs:21
Cassette.Configuration.CassetteSettings.ExecuteCassetteConfiguration(IEnumerable`1 cassetteConfigurations) +209
Cassette.Configuration.CassetteSettings.GetBundleContainerFactory(IEnumerable`1 cassetteConfigurations) +15
Cassette.CassetteApplicationContainerFactoryBase`1.CreateApplication() +114
Cassette.CassetteApplicationContainer`1.CreateApplication() +59
System.Lazy`1.CreateValue() +416
System.Lazy`1.LazyInitValue() +152
System.Lazy`1.get_Value() +75
Cassette.Web.StartUp.InitializeApplicationContainer() +110
Cassette.Web.StartUp.PostApplicationStart() +209

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +233
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +21
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
WebActivator.BaseActivationMethodAttribute.InvokeMethod() +239
WebActivator.ActivationManager.RunActivationMethods() +495
WebActivator.ActivationManager.RunPostStartMethods() +27
WebActivator.StartMethodCallingModule.Init(HttpApplication context) +125
System.Web.HttpApplication.InitModulesCommon() +80
System.Web.HttpApplication.InitModules() +64
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +792
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +298
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +322

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17379
```

I didn't touch the Configuration of the Cassette (this is a new project) so it is with the factory configuration. The only page that refers to a resource is the layout page with the following:

``` html
@{
Bundles.Reference("Content/css/home.css", "head");
Bundles.Reference("Scripts/jquery-1.7.2.js", "head");
Bundles.Reference("Scripts/knockout-2.1.0.js", "head");
}


@ViewBag.Title
@Bundles.RenderStylesheets("head")
@Bundles.RenderScripts("head")

@RenderBody()
@Bundles.RenderHtmlTemplates()
@Bundles.RenderScripts()

```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.