How do you install Castle Windsor IOC? - asp.net-mvc

I'm currently reading Pro ASP.NET MVC Framework by Sanderson. In the book he recommends setting up IoC using Castle Windsor, and he points out that the download automatically installs it and registers the Castle DLLs in the GAC. Well, at this point in time (5/4/2010), the Castle Project no longer has a downloadable installer that sets this up. Its all broken out into their individual subprojects with the raw files contained in zipped folders. Sadly there's no installation documentation that I can find about how to set it up. Being the noob that I am, I'm stuck and now forced to ask #1 where should castle windsor live on my hard drive? #2 how do I manually register the dlls properly? And, #3 should I be angry at the project maintainers for their oversight?
Here's the link:
http://www.castleproject.org/castle/download.html

Sanderson's book is already somewhat outdated about the Castle - ASP.NET MVC integration.
There is no oversight here really, the Castle developers team decided that the project was getting too big to be efficiently managed, so they split it. So now each of these new projects ships as a separate bundle, which includes the necessary DLLs.
There is no installer because it's really not necessary. As with most open source .Net libraries (like NHibernate, log4net, Rhino.Mocks, Moq, and lots others) you get the DLL, put it in some directory in your project (most people call it lib or Dependencies), then from your project you add a reference to the DLLs in this directory. No need to mess with the GAC at all.
You also need to get MvcContrib (the one that says MVCContrib.Extras.release.zip), which implements the Windsor - ASP.NET MVC integration (controller factory and extensions to register controllers, among other things). In fact, MvcContrib already includes Windsor so that's all you really need.

You are looking for the Castle MicroKernel/Windsor project: http://www.castleproject.org/container/index.html
Here is a link to the "Getting Started" page:
http://www.castleproject.org/container/gettingstarted/part1/index.html
Once you have downloaded the ZIP file, extract it to a known location on your hardrive (inside the Visual Studio solution directory is normal).
Follow the "Getting Started" guide, it steps you through which DLL's to reference in your project, and how to use it
Good luck!

Related

Updated ASP.NET Web Application (.NET Framework) MVC5 Project Template

The project that visual studio 2019 creates for an ASP.NET Web Application (.NET Framework) MVC5 comes with Bootstrap 3.x and many other outdated components. Not to mention unneeded things like modernizr.
If you update Bootstrap, you know need to modify the ScriptBundle in BundleConfig to get the application to start, and then modify the CSS to get the premade web pages to render properly.
Also, the folder structure is not the best.
Is there a project template out there that has all essential components updated, and a clean-up NuGet and folder structure?
I tried using Rider but they do not have a built-in template.
I went t the .Net Foundation GitHub and did not find any: https://github.com/dotnet?q=.NET+framework&type=&language=c%23&sort=
I also search GitHubub and did not see any: https://github.com/search?q=ASP.NET+Web+Application+%28.NET+Framework%29+project+template
I am looking for a project template that has the basic structure to create a Clean Architecture in .NET Framework and not .NET Core
I know it's legacy, but unfortunately, I need it for a university class (University courses take a while to get updated, and in this case, they claim that there are sufficient companies out there using ASP.NET MVC 5 to Merrit them teaching it) But yes, No one should be using this to start a new project they intend to put into a real-life production scenario.
Thank you

How to analyze Kentico 7 installation for dependencies and custom web parts

Using Kentico for the first time and have inherited a version 7 project with custom web parts. There are folders with .cs files, folders with .dlls, and folders with .ascx/ascx.cs web parts. Most are active. Some are not.
What's the best way to assess what is used and what is compiled when looking at a Kentico instance? I'm trying to sort what Kentico stores for configuration, how Kentico knows what to compile, and how Kentico provides a pathway for custom ascx/ascx.cs webparts to use (via using) various libraries in folders on the Kentico instance folder structure.
Having worked with Kentico for quite a while it's pretty easy to identify them simply by looking in a few directories.
If you haven't worked with it before you might try to do a fresh install of version 7 which you can get from the Kentico Client Portal and compare them.
If the install was done with best practices, you can look in the following documentation and the "custom code" should be in the green and blue directories in the documentation.
There is an open-sourced utility called KInspector (it`s made by Kentico consulting team). This utility should show you your custom code (among the others) in Kentico instance (afaik it is in the Analysis module).

Umbraco class library and Web Site

I have a project I was brought onto a few years ago and the original developer is no longer available. We have an Umbraco 6 based website. The solution has two projects, a Web Site and a class library call Umbraco.Extensions. I believe I read some conventional wisdom pertaining to Umbraco at some point where it is recommended to split it up like this but I am looking for more information about this particular style of setup and how it is supposed to work. For example right now I am dealing with a missing assembly issue, and i fixed it by copying a dll from the bin of Extensions to the bin of the Web Site. How is this handled regularly?
it's generally a good idea to keep the projects separated. You should have some kind of automation (maybe a post-build action) to copy the dll of the class library to the bin of the umbraco project. Or maybe rebuild the umbraco project with the correct references, but I dont usually do that.

Monodevelop MVC3 razor - what is the trick to get it to work?

I use monodevelop 3.0.4.7 and mono 2.11.4 on mac OS 10.8.
When I create a new solution from scratch in monodevelop I can create several types of ASP.NET mvc3 projects with razor views, but the projects get created with references to system.web.helpers and system.web.webpages that are "not available for Mono/.net 4.0 in mono 2.11.4" and won't build.
If I change my .net version to 4.5 in the project options I get the system.web.webpages reference resolved, and if I simply remove the reference to system.web.helpers I am able to build the default site. However, it is unable to make use of .cshtml views, it only looks for aspx views.
I have tried different things related to references and versions of mono, changing the viewengine to razor in global.asax.cs and even copied dll's from a windows-based asp.net mvc application, but something new breaks all the time.
It seems strange that there are project types included that don't work from scratch, so I'm guessing/hoping I'm missing something much simpler?
I was sitting with the exact same problem, on Linux though, so I decided to ask on the mono mailing list (see the answer to my question here: http://lists.ximian.com/pipermail/mono-list/2012-October/049022.html).
The short answer is: no, you're not missing anything simple.
Long version: The current version of mono is not compiling the System.Web.Helpers.dll, so you have to do some footwork your self, to get it compiled. That is described in the link above.
I guess we just have to wait a little longer before this becomes part of the mono framework :/
I happened across a solution for this issue here:
http://blog.miraclespain.com/archive/2013/Jun-24.html
Basically in xamarin studio you can add a version of nuget from the following add-in repository source:
http://mrward.github.com/monodevelop-nuget-addin-repository/4.0/main.mrep
Once nuget is installed, you can create a new mvc3 razor project, notice the missing references for system.web.helpers and system.web.pages and just remove them, then use nuget to add the microsoft aspnet web pages 2 package which solves the missing references.

Sharing ASP.NET MVC applications

Like everybody else on this planet, I am currently working on a blogging engine using ASP.NET MVC .
I am planning to make this open source under GPL, with a requirement that people already have ASP.NET 3.5 already installed on their machines. Let us say that they do not already have ASP.NET MVC installed (on a shared host)
But, I would like them to host my application inspite of that.
I found this interesting post here by Haack http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx, which suggests to include the below references in Bin directory
System.Web.Mvc
System.Web.Routing
System.Web.Abstractions
My question is, Is it legal for me to include these assemblies in the bin directory when sharing the application?
Thanks,
Chandra
Yes it is. These are redistributable assemblies.
The license is MS-PL, an open source license from Microsoft that allows redistribution.
http://weblogs.asp.net/scottgu/archive/2009/04/01/asp-net-mvc-1-0.aspx
The only catch is that it's not compatible with GPL, so you may want to think of using a different open source license for your project.
Since ASP.NET MVC is released under the Microsoft Public License, you can read more here http://www.opensource.org/licenses/ms-pl.html
I'd say that'd be perfectly legal. It is open source after all.
You can also read some more about the license here: http://www.opensource.org/licenses/ms-pl.html

Resources