Developing for ASP.NET-MVC without Visual Studio - c#

Instead of writing my ASP.NET C# applications in Visual Studio, I used my favorite text editor UltraEdit32.
Is there any way I can implement MVC without the use of VS?

There is nothing VS specific with the MVC framework - it is just a bunch of DLLs that you can use. The wizards in VS just build you a quick-start framework.
ASP.NET MVC is "bin-deployable" - there is nothing too clever to set up on the server either - just point the wildcard ISAPI filter to ASP.NET

Assuming you have the correct assemblies and a C# compiler you in theory can use whatever you want to edit the code and then just run the compiler by hand or using a build script. That being said it is a real pain doing .NET development without Visual Studio/SharpEdit/Monodevelop in my opinion.

Even if you didn't want to actually edit in VS, you could create the project there and edit the files in another editor.

For small to mid size mvc project WebMatrix is not bad at all. Also for simple changes to the projects I often use SublimeText.

Related

Why do I have to rebuild/restart my asp.net web application in visual studio on one project and not on the other one?

I have two different asp.net web- applications. One was created with vs2010, the other one was created with vs2012. I do now only use vs2012 for both of them.
There is one thing I do not understand:
In my older application created with vs2010 I can change the code in my .cs file and all I have to do is to press F5 in my Browser to see the changes.
On the newer application I always have to rebuild or restart to see the changes I made. Why is that? Is it possible to change that?
Both projects are asp.net/c# with .net framework 4.0
Thanks in advance
It appears that one of your projects was set up as a "Web Application" project and the other as a "Web Site" project. The difference between the two are described here: https://msdn.microsoft.com/en-us/library/dd547590(v=vs.110).aspx
It's important to note that although you may find them more convenient, "Web Site" projects have been essentially deprecated after VS2012 and have not received access to many new ASP.NET features.
As far as editing code without restarting in a "Web Application" I'd recommend looking into the Edit & Continue functionality, which allows you to edit code while debugging. Although it definitely has its limitations. You can read more about that here: https://msdn.microsoft.com/en-us/library/x17d7wxw(v=vs.110).aspx

Convert a VB project to C# Visual Studio 2012

I have a fairly straight-forward question.
I have been working on a .NET web development project for about two weeks now, and I JUST got Visual Studio 2012 and I very much THOUGHT I had set it up to default to C# projects. Silly me.
I have not written a single solitary line of code yet, so when I finally roll up my sleeves and prepare to dive in to writing some code...I encounter the unpleasant surprise that I have developed the entire interface of the application without realizing this is a VB project, not a C# one.
I do not have ANY code to translate, I just want to know if there is a way to just change it over to C# without having to recreate the whole project in another file.
Since the work you've done is non .NET I recommend creating a new C# project and porting it over.
However I recommend:
The VB.NET project is in source control and fully checked in
You create a new C# project so you can work on them side-by-side
You can use a diff editor such as WinMerge to ensure the important files are moved and are kept the same relative to each other.

How do I make a MVC project appear properly in Visual Studio?

How do I make a MVC project appear properly in Visual Studio? I understand the logic of this sort of structure. I have seen some blogs and explanations and even code segments explaining how a program can use MVC. But I want to know what is a good way to represent a Model-View-Controller program in the Visual Studio.
For example, in an ASP.NET program, the asp.net file is associated with a C# file. THey have the same name and, in the Solution Explorer window of the Visual Studio development environment, they are shown linked together where one is a tree branch of the other. Should the same sort of thing be done for a MVC solution? I can remember a few years ago, I worked on a MVVM project, and a developer who first put the solution file together actually had view and the view-model files arranged like this. In order to make this happen, he had to download some sort of patch that allowed him to edit the .sln (solution) file.
Is that the way to go for a Model-View-Controller program? Should each be its own workspace in the solution, or should the solution file be edited such that each Model-View-Controller coupling be handled as a tree structure file representation kind of like it is done for an ASP.NET solution?
Here is another question. What is a good template to use in Visual Studio to create an example of a Model-View-Controller program? I tried this route but when I clicked to "get new templates", it did not work:
http://i67.photobucket.com/albums/h292/Athono/Embedded/Capture_02_zps6vn4ri07.png
http://i67.photobucket.com/albums/h292/Athono/Embedded/Capture_zpscdczk1b4.png
From your screenshots, it looks like you're using an old version of Visual Studio (either 2008 or 2010, there isn't enough showing to be sure, but I see the default .NET framework listed as 3.5 up there).
The latest versions of the ASP.NET MVC framework requires .NET 4.5. Visual Studio 2010 doesn't support this, so the solution is to upgrade to a newer version of Visual Studio which includes support and project templates specifically for the latest versions of ASP.NET MVC.

Create Solution/Project programmatically without Visual Studio

I would like to create a Visual Studio Solution and a C# Project programmatically, but without a instance of Visual Studio installed on the machine.
Scenario
I am trying to build a "engine" that will read some metadata in a SQL database and transform them into a UI. The database will be maintained by another people with a Web or WCF interface and I want the Server Application frequently (by schedule or pressing a button) use this informations to create autommaticaly a new version of the software (create solution -> project -> build -> create deployment).
So, I searched about programmatically create Solution and I found only the Automation Model in VS, it's about use an Add-In Project and this don't serves for my propose.
Perhaps I was a little confused in my explanation, so ask me more especific details, so I can be more accurate :)
Thanks for help
I think generating the solution is a little extreme.
The solution file structure hasn't changed much since 2005 http://msdn.microsoft.com/en-us/library/bb165951(v=VS.80).aspx, and there are a few projects trying to automate their generation, like Premake https://bitbucket.org/premake.
However, the kind of scenario you describe, might be I believe (better?) adressed with t4 templates http://msdn.microsoft.com/en-us/library/vstudio/bb126445.aspx, or only project file generation.
What you are describing is possible to do in C# Windows app but tedious and difficult. I remember seeing VB6.0 app like that but here i would suggest you look into WPF. Still it's C# programming but WPF can load dynamically a "window" from a string or a file if you want.

How do I set the flags/switches for the aspnet_compiler in Visual Studio 2010?

I'm having some trouble with namespacing for a web application project - front-end files are being compiled into separate assemblies under the ASPX.directory1_director2_directoryn_filename namespace format and I want everything in one dll.
I found this question and setting the -o flag would appear to be exactly the solution I'm looking for. However I build my code in VS2010 using the standard Build menu option and I can't find anywhere I can set it. Can anyone point me in the right direction?
I suppose you meant aspnet_compiler. Here is a tutorial. It's related to Visual Web Developer 2008. But the basic idea is the same - use the External Tools dialog to create you desired action.
If you're using a Web Site Project, the ASP.NET compiler options can be used from the Publish dialog. For a Web Application Project, you can use Web Deployment Projects to enable pre-compilation (technically, WDP should work for WebSites as well).

Categories