Showing posts with label visual studio. Show all posts
Showing posts with label visual studio. Show all posts

Aug 22, 2013

Difference between Web Application and Web Site Projects


In Visual Studio we can create Web application projects or web site projects. We create or open a web application project by choosing New Project or Open Project in the Visual Studio File menu. We create or open a web site project by choosing New Web Site or Open Web Site in the File menu. It’s best to choose the right type before we create a web project, because it can be time-consuming, difficult, and error-prone to convert from one type to the other.

Scenarios

Scenarios in which web application projects are the preferred choice include the following:
  • We want to be able to use the Edit and Continue feature of the Visual Studio debugger.
  • We want to run unit tests on code that is in the class files that are associated with ASP.NET pages.
  • We want to refer to the classes that are associated with pages and user controls from standalone classes.
  • We want to establish project dependencies between multiple web projects.
  • We want the compiler to create a single assembly for the entire site.
  • We want control over the assembly name and version number that is generated for the site.
  • We want to use MSBuild or Team Build to compile the project. For example, we might want to add prebuild and postbuild steps.
  • We want to avoid putting source code on a production server.
Scenarios in which Web site projects are the preferred choice include the following:
  • We want to include both C# and Visual Basic code in a single web project. (By default, a web application is compiled based on language settings in the project file. Exceptions can be made, but it is relatively difficult.)
  • We want to open the production site in Visual Studio and update it in real time by using FTP.
  • We do not want to have to explicitly compile the project in order to deploy it.
  • If we do precompile the site, we want the compiler to create multiple assemblies for the site, which can include one assembly per page or user control, or one or more assemblies per folder.
  • We want to be able to update individual files in production by just copying new versions to the production server, or by editing the files directly on the production server.
  • If we precompile the site, we want to be able to update individual ASP.NET web pages (.aspx files) without having to recompile the entire site.
  • We like to keep your source code on the production server because it can serve as an additional backup copy.

Summary of Differences

The following table summarizes the main differences.
Area
Web application projects
Web site projects
Project file structure
A Visual Studio project file (.csproj or .vbproj) stores information about the project, such as the list of files that are included in the project, and any project-to-project references.
There is no project file (.csproj or .vbproj). All the files in a folder structure are automatically included in the site.
Compilation
  • We explicitly compile the source code on the computer that is used for development or source control.
  • By default, compilation of code files (excluding .aspx and .ascx files) produces a single assembly.
  • The source code is typically compiled dynamically (automatically) by ASP.NET on the server the first time a request is received after the site has been installed or updated.
We can precompile the site (compile in advance on a development computer or on the server).
  • By default, compilation produces multiple assemblies.
Namespaces
Explicit namespaces are added to pages, controls, and classes by default.
Explicit namespaces are not added to pages, controls, and classes by default, but we can add them manually.
Deployment
  • We copy the assembly to a server. The assembly is produced by compiling the application.
  • Visual Studio provides tools that integrate with Web Deploy (the IIS web deployment tool) to automate many deployment tasks.
  • We copy the application source files to a computer that has IIS installed on it.
  • If we precompile the site on a development computer, we copy the assemblies produced by compilation to the IIS server.
  • Visual Studio provides tools that integrate with Web Deploy (the IIS web deployment tool) to automate many deployment tasks.


Project File Structure
Web application projects use Visual Studio project files (.csproj or .vbproj) to keep track of information about the project. This makes it possible to specify which files are included in or excluded from the project, and therefore which files are compiled during a build.
For web site projects, all files in a folder structure are automatically considered to be included in the web site. If we want to exclude something from compilation, we must remove the file from the web site project folder or change its file-name extension to an extension that is not compiled and is not served by IIS.
An advantage of using project files in web application projects is the following:
  • It is easy to temporarily remove files from the site but still make sure that we do not lose track of them, because they remain in the folder structure. For example, if a page is not ready to be deployed, we can temporarily exclude it from the build without deleting it from the folder structure. We can deploy the compiled assembly, and then include the file in the project again. This is especially important if we are working with a source control repository.
An advantage of using folder structure without project files in Web site projects is the following:
  • We do not have to manage the project's structure exclusively in Visual Studio. For example, we can copy files into the project or delete them from the project by using File Explorer.

Compilation
For web application projects, we typically build the project in Visual Studio or by using the ASP.NET batch compiler on a computer that is not the production IIS server. All code-behind class files and standalone class files in the project are compiled into a single assembly, which is then put in the web application project's Bin folder. (The .aspx and .ascx files are compiled dynamically in a manner similar to what is done for web site projects.)
For web site projects, we do not have to manually compile the project. web site projects are typically compiled dynamically by ASP.NET (on both the development computer and the production IIS server). We can choose between batch compilation mode, which typically produces one assembly per folder, and fixed compilation mode, which typically produces one assembly for each page or user control.
Advantages of the compilation model for web application projects include the following:
  • We can use MSBuild to create a custom batch-compilation process.
  • It is easy to specify assembly attributes such as name and version.
  • Compiling in advance makes sure that users do not have to wait while the site compiles on the production server. (If the site is very large, dynamic compilation of a web site project might take a noticeable amount of time. Dynamic compilation occurs when a request for a site resource is received after an update to the site, and the request that triggers compilation might be delayed while the required resources are compiled. If the delay is unacceptable, we can precompile the site. However, then some of the advantages of dynamic compilation are lost.)
  • We have complete control over where we put code files in the project folder structure, and how we how classes in the project refer to each other. (Dynamic compilation requires that the source code for any classes that are used throughout the site must be in the App_Code folder. We cannot refer to a page or user control class from a class in App_Code.)
Advantages of the compilation model for Web site projects include the following:
  • We can test specific pages regardless of the state of other pages. This is because running an individual page does not require that the whole site compile successfully, only the page and any components it depends on, such as code in the App_Code folder or the Global.asax file. (In a web application project, if there are compilation errors anywhere in the site, we cannot create the assembly and therefore cannot test even the pieces of the site that compile.)
  • It is easy to update a Web site in production. We can update individual source code files on the production server without having to explicitly recompile the site. We can update individual files that are ready for deployment even if other files are not ready due to compile errors. We can also open the Web site on the production IIS server directly in Visual Studio and update the Web site in real time.
  • Precompiling to multiple assemblies can have a performance advantage in some scenarios. A typical example is a site that has many pages with lots of code written for them. Most of the pages are rarely requested and only some are used frequently. If we compile a site like this into multiple assemblies, the production server can load only the assemblies that are required for the current requests. If a page is not requested, its corresponding assembly is not loaded.




Aug 16, 2013

Alternative to Visual Studio.Net IDE

Below are few alternatives to the Integrated Development Environment (IDE) - Visual Studio for .Net Development

Pao (short for "program as objects") is firstly an idea that a computer program is reprensented totally as objects, as opposed to textual code in the traditional way. This objectization covers all the aspacts of a program, including the internal respresentation, persistance on storage, user interface, editing, debugging, documentation, etc. Pao is a general-purpose programming environment. Currently, it supports microsoft .NET windows application development. Its language(Pao#) covers most sementics of C# (up to v3.5)

MonoDevelop is a cross-platform IDE primarily designed for C# and other .NET languages. MonoDevelop enables developers to quickly write desktop and ASP.NET Web applications on Linux, Windows and Mac OSX. MonoDevelop makes it easy for developers to port .NET applications created with Visual Studio to Linux and Mac OSX maintaining a single code base for all platforms.

CodeRun Studio is a cross-platform Integrated Development Environment (IDE), designed for the cloud. It enables you to easily develop, debug and deploy web applications using your browser. CodeRun Studio can be used instead or alongside your existing desktop IDE. You can upload existing code in order to test it in the cloud or for sharing with your peers.

#develop (short for SharpDevelop) is a free IDE for C#, VB.NET and Boo projects on Microsoft's .NET platform. It is open-source, and you can download both sourcecode and executables from this site. 

Zeus is a fast and lean, fully scriptable, keyboard centric editor packed full of programmer specific features making it one of the best programmer's editor available.

Will try to add few more over coming weeks.

Jul 16, 2013

Productivity Power Tools and Commands

Productivity Power Tools 2010


Features:

Enhanced Scrolling
Middle-Click Scrolling
Organize Imports for Visual Basic
Solution Navigator
Tab Well UI - Allows you to completely customize the behaviour of your document tabs.
Searchable Add Reference Dialog
Quick Access - Quick Access is a new tool window that allows users to search for and execute common tasks within the Visual Studio IDE. 
Auto Brace Completion
HTML Copy 


Productivity Power Tools 2012


Features:

Quick Tasks
Power Commands
Color Printing
Enhanced Scrollbar
Middle-Click Scrolling 
Organize Imports for Visual Basic
Custom Document Well
Tools Options Support
Auto Brace Completion
HTML Copy
Fix Mixed Tabs
Ctrl + Click Go To Definition
Align Assignments
Move Line Up/Down Commands
Column Guides
Colorized Parameter Help


PowerCommands for Visual Studio 2010

Download PowerCommand from here.


Features:



Format document on save / Remove and Sort Usings on save
The Format document on save option formats the tabs, spaces, and so on of the document being saved. It is equivalent to pointing to the Edit menu, clicking Advanced, and then clicking Format Document. The Remove and sort usings option removes unused using statements and sorts the remaining using statements in the document being saved.

Clear All Panes
This command clears all output panes. It can be executed from the button on the toolbar of the Output window.

Copy Path
This command copies the full path of the currently selected item to the clipboard. It can be executed by right-clicking one of these nodes in the Solution Explorer: The solution node; A project node; Any project item node; Any folder.

Email CodeSnippet
To email the lines of text you select in the code editor, right-click anywhere in the editor and then click Email CodeSnippet.

Insert Guid Attribute
This command adds a Guid attribute to a selected class. From the code editor, right-click anywhere within the class definition, then click Insert Guid Attribute.

Show All Files
This command shows the hidden files in all projects displayed in the Solution Explorer when the solution node is selected. It enhances the Show All Files button, which normally shows only the hidden files in the selected project node.

Undo Close
This command reopens a closed document , returning the cursor to its last position. To reopen the most recently closed document, point to the Edit menu, then click Undo Close. Alternately, you can use the CtrlShiftZ shortcut.


Collapse Projects
This command collapses a project or projects in the Solution Explorer starting from the root selected node. Collapsing a project can increase the readability of the solution. This command can be executed from three different places: solution, solution folders and project nodes respectively.

Copy Class
This command copies a selected class entire content to the clipboard, renaming the class. This command is normally followed by a Paste Class command, which renames the class to avoid a compilation error. It can be executed from a single project item or a project item with dependent sub items.

Paste Class
This command pastes a class entire content from the clipboard, renaming the class to avoid a compilation error. This command is normally preceded by a Copy Class command. It can be executed from a project or folder node.

Copy References
This command copies a reference or set of references to the clipboard. It can be executed from the references node, a single reference node or set of reference nodes.

Paste References
This command pastes a reference or set of references from the clipboard. It can be executed from different places depending on the type of project. For CSharp projects it can be executed from the references node.

Copy As Project Reference
This command copies a project as a project reference to the clipboard. It can be executed from a project node.

Edit Project File
This command opens the MSBuild project file for a selected project inside Visual Studio. It combines the existing Unload Project and Edit Project commands.

Open Containing Folder
This command opens a Windows Explorer window pointing to the physical path of a selected item. It can be executed from a project item node

Open Command Prompt
This command opens a Visual Studio command prompt pointing to the physical path of a selected item. It can be executed from four different places: solution, project, folder and project item nodes respectively.

Unload Projects
This command unloads all projects in a solution. This can be useful in MSBuild scenarios when multiple projects are being edited. This command can be executed from the solution node.

Reload Projects
This command reloads all unloaded projects in a solution. It can be executed from the solution node.

Remove and Sort Usings
This command removes and sort using statements for all classes given a project. It is useful, for example, in removing or organizing the using statements generated by a wizard. This command can be executed from a solution node or a single project node.

Extract Constant
This command creates a constant definition statement for a selected text. Extracting a constant effectively names a literal value, which can improve readability. This command can be executed from the code editor by right-clicking selected text.

Clear Recent File List
This command clears the Visual Studio recent file list. The Clear Recent File List command brings up a Clear File dialog which allows any or all recent files to be selected.

Clear Recent Project List
This command clears the Visual Studio recent project list. The Clear Recent Project List command brings up a Clear File dialog which allows any or all recent projects to be selected.

Transform Templates
This command executes a custom tool with associated text templates items. It can be executed from a DSL project node or a DSL folder node.

Close All
This command closes all documents. It can be executed from a document tab.