Is inline coding with razor the only option with webmatrix? - webmatrix

Or is it also compatible with asp.net or asp.net mvc?

Check out this great post from Dave Ebbo: Link
WebMatrix is really a tooling story, that comes with a stack (IIS Express, SQL CE 4 and Razor) enabling you to create a new breed of ASP.NET page or site. Not only can you use WebMatrix to edit and maintain traditional ASPX pages (a la Forms or MVC), but you can use WebMatrix to edit PHP files, work with MySQL databases and manage PHP-based open-source apps (WordPress, Joomla, etc.)
Bottom line: inline with Razor is not the only option when using WebMatrix, though it is the default when creating new pages.

WebMatrix only supports a folder-based project (i.e. a WebSite, not a Web Application Project). Because of this ASP.NET MVC is not supported.
However, you can have pure .cs files that you can reference from your .cshtml files. Just drop them in the App_Code folder.

Scott Guthrie's blog post shows examples of inline code with both razor and regular asp.net tags. Webmatrix is just a "work environment" - it lets you edit ASP.Net and ASP.Net MVC pages, it's not exclusive of them.
As far as I understand it, razor syntax is just built on top of existing ASP.Net parsing, and you can choose to use it exclusively or mix it in with older ASP.Net stuff with no problems. I could be off on that though.

Related

How do I install MVC3 on a server without using the Web Platform Installer (and without Visual Studio)?

How do I install MVC3 on a server without using the Web Platform Installer (and without Visual Studio)?
I can't seem to locate a standalone installer, and the server won't have VS, and I can't ensure that all the apps will have the binaries included to run it on native .NET4.
Is the only way to install MVC3 support with VS support, even if VS isn't around?
In case it isn't obvious, I'm trying to give the IT group a baseline of packages to install, and the easiest way to do that is to give them the binaries and a few scripts
Referencing the link on http://www.asp.net/mvc/mvc3 we get a link to http://www.microsoft.com/en-us/download/details.aspx?id=1491 | ASP.NET MVC 3 Tools Update
I think that's what you're looking for.
ASP.NET MVC 3 is a framework for developing highly testable and maintainable Web applications by leveraging the Model-View-Controller (MVC) pattern. The framework encourages developers to maintain a clear separation of concerns among the responsibilities of the application – the UI logic using the view, user-input handling using the controller, and the domain logic using the model. ASP.NET MVC applications are easily testable using techniques such as test-driven development (TDD).
The installation package includes templates and tools for Visual Studio 2010 to increase productivity when writing ASP.NET MVC applications. For example, the Add View dialog box takes advantage of customizable code generation (T4) templates to generate a view based on a model object. The default project template allows the developer to automatically hook up a unit-test project that is associated with the ASP.NET MVC application.
You can download it from : https://www.microsoft.com/es-es/download/details.aspx?id=4211
Is the 3.0.0.0 version and you can reference manually the DLL from : C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll
Other versions : https://stackoverflow.com/a/5485175/5775048
Install the MVC3 runtime from this link: http://www.microsoft.com/en-us/download/details.aspx?id=4211.
Go to c:\windows\microsoft.net\framework[64]\v4.0.30319 and run aspnet_regiis -i (adjusting for whatever version of .Net is appropriate).
Restart IIS.
This has always worked for me, although at the moment I'm having an issue because the installer installs 3.0.0.0 and my app is looking for 3.0.0.1.

Asp.net mvc Files required for deployment aren't reference in the project during development

After reading quite few articles on deployment, i am bit confused about the procedure.
All the articles refer to dlls which aren't reference in Asp.net mvc project. The dlls are like following :-
Microsoft.Web.Infrastructure.dll
System.Web.Razor.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.Razor.dll
I created the MVC Music Store application from a tutorial on asp.net website and it works fine in visual studio. In the project, there is no reference to the above given assemblies(not even the razor but i am using razor engine only).
So why should i add the above files to the bin directory if my project is running without referencing them in the first place
Those assemblies need to be available somehow. If you have installed ASP.NET MVC 3 then they will be registered in the GAC (see here: http://weblogs.asp.net/scottgu/archive/2011/01/18/running-an-asp-net-mvc-3-app-on-a-web-server-that-doesn-t-have-asp-net-mvc-3-installed.aspx).
If not (e.g. if you are using shared hosting which doesn't have ASP.NET MVC 3 installed), then you will need to bin deploy them as described here: http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx
Refer to the second link to actually do the deployment. The first link is more for background reading.

asp.net Mvc3 Razor : is there a way to compile a single view from vs2010 ide

I know it's possible to compile all views on building the project... but I was wondering if there is a way to compile a single view on demand in the VS2010.
That way, when you change a view, you could compile this one view (instead of letting VS2010 build all views).
As far as I know Microsoft did not yet add support for precompiling Razor views. But the team released a VS2010 extensions that should allow this. You may check out the following blog post from David Ebbo:
Precompile your MVC Razor views using RazorGenerator
Here is another appreach:
Compile your asp.net mvc Razor views into a seperate dll

I'm upgraded my project to Razor view engine, but VS2010 still auto-generates WebForms

I have upgraded to MVC3 and Razor, everything works fine. However, in my return View(model); the "View" is red and VS2010 will helpfully suggest I generate a view. When I do, it generates a aspx/WebForms view. There's no other aspx files in the project, and if I run the project, the Razor view engine works fine. There's obviously a setting somewhere that tells VS2010 which to default to, I can't find it. Any suggestions?
These are not explicit answer but rather a list of actions that you could try..
In the csproj file of your project make sure that the <ProjectGuidType> are set to <ProjectTypeGuids>{E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
Try changing the ProjectGuid to some other Guid (last post). You will need to update the sln file or simply recreate the solution.
Not sure what method you used to upgrade, but have a look at the MVC 3 Upgrade Tool from CodePlex
If you can create a new ASP.NET MVC 3 project and add a Razor view as expected then the project where you are seeing this behavior is missing the ASP.NET MVC 3 project type guid, which you can find in a new ASP.NET MVC 3 project's .csproj file. If you can't do this than you should try reinstalling the ASP.NET MVC 3 Tools Update.

How to Disable ASP.net AJAX Framework in ASP.net 3.5

I'm working on an ASP.net 3.5 website with MooTools as the AJAX framework. I want to disable ASP.net's AJAX framework so it behaves more like ASP.net 2.0. This is to decrease page loading times and to reduce incompatibilities. Is this possible and if so how do I go about it?
I was able to remove the System.Web.Extensions assembly from the references, and then I found and removed all instances of the ScriptManager control.
Once I did this, none of the AJAX framework stuff is rendered to the pages.
I wanted to keep 3.5 for LINQ and other jazz, so just targeting the 2.0 framework wouldn't work.
Thanks for the tips.
I've seen some articles on how to improve the performance of asp.net ajax in the .net 3.5 framework. Just can't find the link. But there are some changes you can do in the web.config which will improve performance wise. But, if you want to use MooTools, i guess you can just remove the Assemblies and the remove all references in the web.config.
There are a few ways you can do this.
If you are using Visual Studio 2008 when you create projects/websites make sure you target .net framework 2.0. If you do not use any of the controls/extenders with framework 3.5 you will not reference any 3.5 assemblies. To be sure of that take a look at the web.config file and settle issues.
I see that you are looking to use moo tools, the above mentioned settings and jquery for your custom javascript stuff should get your job done.
Thats all I can say per my knowledge.
Happy coding!

Resources