<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Azure Bundle Problem In MVC &#8211; Sibeesh Passion</title>
	<atom:link href="https://www.sibeeshpassion.com/tag/azure-bundle-problem-in-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Tue, 10 Jul 2018 10:29:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>Azure Bundle Problem In MVC &#8211; Sibeesh Passion</title>
	<link>https://www.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Fix To: Bundles Are Not Working After Hosting To MVC Application</title>
		<link>https://www.sibeeshpassion.com/fix-to-bundles-are-not-working-after-hosting-to-mvc-application/</link>
					<comments>https://www.sibeeshpassion.com/fix-to-bundles-are-not-working-after-hosting-to-mvc-application/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Sun, 24 Apr 2016 00:00:23 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Azure Bundle Problem In MVC]]></category>
		<category><![CDATA[Bundle Problem After Publishing]]></category>
		<category><![CDATA[Bundling not working when deployed to web host]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[MVC bundle css not working]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=11527</guid>

					<description><![CDATA[In this article we are going to see how we can fix if you are getting some reference errors, or if your bundles are not getting configured properly in your server. I have fixed this issue, and here I am going to share you how you can also fix this error. I hope you will like this. Background Recently I hosted one of my MVC application to Microsoft Azure cloud. And we usually publish our application in release mode right? So here the problem comes. You can replicate the same issue in your local machine itself. Just make the debug [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this article we are going to see how we can fix if you are getting some reference errors, or if your bundles are not getting configured properly in your server. I have fixed this issue, and here I am going to share you how you can also fix this error. I hope you will like this.</p>
<p><strong>Background</strong></p>
<p>Recently I hosted one of my MVC application to Microsoft <a href="http://sibeeshpassion.com/category/Azure/" target="_blank">Azure</a> cloud. And we usually publish our application in release mode right? So here the problem comes. You can replicate the same issue in your local machine itself. Just make the debug attribute to false in your Web.config as follows.</p>
<p>[xml]<br />
 &lt;compilation debug=&quot;false&quot; targetFramework=&quot;4.5&quot; /&gt;<br />
[/xml]</p>
<p>And when you run, you will get a prompt as follows. </p>
<div id="attachment_11528" style="width: 602px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Run-without-debugging.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-11528" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Run-without-debugging.png" alt="Run without debugging" width="592" height="247" class="size-full wp-image-11528" srcset="/wp-content/uploads/2016/04/Run-without-debugging.png 592w, /wp-content/uploads/2016/04/Run-without-debugging-300x125.png 300w, /wp-content/uploads/2016/04/Run-without-debugging-400x167.png 400w" sizes="(max-width: 592px) 100vw, 592px" /></a><p id="caption-attachment-11528" class="wp-caption-text">Run without debugging</p></div>
<p>Just select Run without debugging option. Now once after your application is run, you can see some script errors in your browser console saying that the references are not loaded correctly. </p>
<div id="attachment_11529" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Release-more-error-in-console-e1461154379556.png"><img decoding="async" aria-describedby="caption-attachment-11529" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Release-more-error-in-console-e1461154379556.png" alt="Release more error in console" width="650" height="127" class="size-full wp-image-11529" srcset="/wp-content/uploads/2016/04/Release-more-error-in-console-e1461154379556.png 650w, /wp-content/uploads/2016/04/Release-more-error-in-console-e1461154379556-300x59.png 300w, /wp-content/uploads/2016/04/Release-more-error-in-console-e1461154379556-400x78.png 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-11529" class="wp-caption-text">Release more error in console</p></div>
<p>And finally I could find the solution. Here we will see that.</p>
<p><strong>Bundles Are Not Working After Hosting To MVC Application</strong></p>
<p>As I said, the problem is with your bundle config settings. There are few things you must check before going to the last fix. </p>
<li>Please make sure that you have used StyleBundle for creating the style bundle</li>
<li>Please make sure that you have used ScriptBundle for creating the style bundle</li>
<li>Make sure that you are loading the styles using @Styles.Render</li>
<li>Make sure that you are loading the scripts using @Scripts.Render</li>
<li>Make sure that the folder structure is same as you have in local system</li>
<p>If none of the above solution works, you can try the last one. </p>
<li>Make sure that virtual path of bundles doesn&#8217;t contains the folder names you have in your solution</li>
<p>I will explain it. In my case my bundles were as follows. </p>
<p>[html]<br />
 @Styles.Render(&quot;~/Scripts/JQWidgets/CSS&quot;)<br />
 @Scripts.Render(&quot;~/Scripts/JQWidgets&quot;)<br />
[/html]</p>
<p>And I have the folders JQWidgets in my root script folder. This was making the issue. </p>
<div id="attachment_11530" style="width: 275px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/04/Folder-structure.png"><img decoding="async" aria-describedby="caption-attachment-11530" src="http://sibeeshpassion.com/wp-content/uploads/2016/04/Folder-structure.png" alt="Folder structure" width="265" height="114" class="size-full wp-image-11530" /></a><p id="caption-attachment-11530" class="wp-caption-text">Folder structure</p></div>
<p>Now what I did is, I just changed my bundle config settings in <em>BundleConfig.cs</em> as follows(Renaming the folder)</p>
<p>[csharp]<br />
bundles.Add(new ScriptBundle(&quot;~/Scripts/Grid&quot;)<br />
 bundles.Add(new StyleBundle(&quot;~/Scripts/Grid/Styles&quot;)<br />
[/csharp]</p>
<p>And I referenced the same bundles as follows in my views. </p>
<p>[csharp]<br />
 @Styles.Render(&quot;~/Scripts/Grid/Styles&quot;)<br />
@Scripts.Render(&quot;~/Scripts/Grid&quot;)<br />
[/csharp]</p>
<p>Please try these steps and build your application. Once that is done you can publish your application to cloud. I hope this will solve your issue. Have a happy coding.</p>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn&#8217;t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sibeeshpassion.com/fix-to-bundles-are-not-working-after-hosting-to-mvc-application/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
