views:

441

answers:

1
 #Html.RenderPartial(MVC.Shared.Views._Sorter);

throws error =>

There is no build provider registered for the extension '.spark'. You can register one in the section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.

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.Web.HttpException: There is no build provider registered for the extension '.spark'. You can register one in the section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.

Any ideas what might be wrong?


Adding this to web.config=>system.web=>compilation

  <buildProviders>
    <add extension=".spark" type="System.Web.Compilation.PageBuildProvider" />
  </buildProviders>

Forces app to build spark view as webforms view and produces ${Something.something} all around. So - what's an equivalent for spark viewengine?

+2  A: 

Can you please try to make the following change to T4MVT.tt. In the method ViewsFolderInfo.AddView, change the line:

Views[viewFieldName] = GetVirtualPath(item);

to

Views[viewFieldName] = viewFieldName;

If that works well, we can just add a switch to the settings file that makes it do this instead of the default full path.

Let me know how that goes!


Note that MVC.Shared.Views._Sorter is just a constant with the path to the view. If you were to write this code without T4MVC, what exact string would you pass in there?

Maybe Spark has different requirements in the type of view paths it accepts here? If needed, we can tweak T4MVC to make this work, but I'd like to fully understand the Spark behavior outside of T4MVC first.

David Ebbo
Problem is - i'm not aware of why exactly it works like that, what spark expects. Pure view name "_Sorter" (without relative path) works. Didn't check if it's the same using web forms viewengine. In case you tweak something, it would be nice if that would be done as progressive enchantment (using that relative path for other purposes at the moment with success (view ids for UI tests)).
Arnis L.
The problem with just passing "_Sorter" is that it doesn't work if the call comes from a different controller. I'll discuss with the Spark folks to see what they suggest.
David Ebbo
Well, I posted a question on http://groups.google.com/group/spark-dev/browse_thread/thread/b296e29e490eb5ee?hl=en, but no one replied. Maybe T4MVC needs an option to only generate simple view names.
David Ebbo
Thought about the same. `ViewNames` right next to `Views`. And still - don't rush with that. Maybe they will answer. :)
Arnis L.
Did you see the suggested change I added to my Answer above? It'd be great if you could test whether that does the trick for you.
David Ebbo
Works like a charm. Feeling a bit ashamed that i didn't figure out this myself (wasn't priority anyway). You are hero of the day! :)
Arnis L.