私はSitecore 8.2 MVCをセットアップし、MVCバンドルを使用してすべてのスクリプトとスタイルをメインレイアウトに取り込もうとしています。グローバルファイルが使用されなくなったので、私は問題にぶち当たっていました。パイプラインを使ってビルドラーを初期化するべきです。Sitecore 8.2 MVCはMVCバンドルを動作させることができません
BundleConfig.cs
using System.Web;
using System.Web.Optimization;
using Sitecore;
using Sitecore.Pipelines;
namespace MySite.Web.Pipelines
{
public class RegisterPlatformBundles
{
[UsedImplicitly]
public virtual void Process(PipelineArgs args)
{
RegisterBundles(BundleTable.Bundles);
}
private void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new StyleBundle("~/bundles/styles").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
}
私は、configファイル、次のパイプラインwiththeにそれを追加しようとしました。
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<initialize>
<processor patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeGlobalFilters, Sitecore.Mvc']"
type="MySite.Web.Pipelines.RegisterPlatformBundles, MySite" />
</initialize>
</pipelines>
</sitecore>
</configuration>
サイトを実行しようとすると、次のエラーが発生します。私がこれを設定するのを助けるためのアドバイスや正しい道だけが素晴らしいものになるでしょう。ありがとう。
Could not resolve type name: MySite.Web.Pipelines.RegisterPlatformBundles, MySite (method: Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)). 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.Exception: Could not resolve type name: MySite.Web.Pipelines.RegisterPlatformBundles, MySite (method: Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)).
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Exception: Could not resolve type name: MySite.Web.Pipelines.RegisterPlatformBundles, MySite (method: Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)).]
Sitecore.Diagnostics.Error.Raise(String error, String method) +137
Sitecore.Configuration.DefaultFactory.CreateType(XmlNode configNode, String[] parameters, Boolean assert) +308
Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert) +71
Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +165
Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, Boolean assert) +68
Sitecore.Pipelines.CorePipelineFactory.GetObjectFromType(XmlNode processorNode) +91
Sitecore.Pipelines.CorePipelineFactory.GetProcessorObject(XmlNode processorNode) +145
Sitecore.Pipelines.CoreProcessor.GetMethod(Object[] parameters) +144
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +470
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
Sitecore.Nexus.Web.HttpModule.Application_Start() +262
Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +704
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +618
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343[HttpException (0x80004005): Could not resolve type name: MySite.Web.Pipelines.RegisterPlatformBundles, MySite (method: Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)).]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +539
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +125 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +731
この[LINK](https://sitecore.stackexchange.com/questions/3434/is-there-something-in-sitecore-8-2-that-breaksを参照してください-bundling) – Thennarasan