Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Same Code in Different Mvc Solutions

I'm using asp.net mvc 3 and .net framework 4.0 with C#

Let's say I have NivoSlider( a slider ) html code. Also it has js, css and image files.

I want to use the NivoSlider cshtml code and js/css/images as "a project" and I want to add it to different MVC solutions. It will become a plugin some-how.

I can't make it a partialview, because I have to move all the css, js and imges files into new solution. I looked at "mvc areas" but it's not rendering my js and css files ( as a matter of fact; using "Areas" is not a perfect way as you know )... I looked up some plugin based architectures, but none-of-them are easy to implement. I have limited time.

So how can I solve this problem ?

EDIT: I can use this http://razorgenerator.codeplex.com/ - But I'm looking for another solutions if you came up with an idea...

like image 217
Lost_In_Library Avatar asked Dec 02 '22 22:12

Lost_In_Library


2 Answers

You could create a private Nuget and create a small installation for it. That way you can install, update, and uninstall directly from the package.

You can even make a localized package that you copy between computers. Nuget has a very easy way to specify where you want to extract files to, and what files you want to extract.

like image 97
nathas Avatar answered Dec 23 '22 20:12

nathas


I'm using razor generator in a commercial project and it's functional but not ideal.

Other possibilities I considered are Add files as link (see Nameless One's answer)

Also overriding the ViewEngine Can I specify a custom location to "search for views" in ASP.NET MVC?

Or even symbolic links (shortcut links to folders in windows) https://superuser.com/questions/234422/does-windows7-support-symbolic-links-folder-shortcuts

like image 40
Kaido Avatar answered Dec 23 '22 21:12

Kaido