Tutorials » AspNet tutorials »

Files created by default by VS.NET


In this chapter you will learn the various files created by Visual Studio when you create a new web project.


This chapter talks about default files generated by Visual Studio .NET 2003. We have not yet updated this page for files generated by VS.NET 2005 or Visual Web Developer Express.

Let us learn more about the default web page created by Visual Studio in the previous chapter.

Ideally, a web page is just one file. For example, if you are viewing a web page called 'Hello.aspx', there will be one physical file called 'Hello.aspx' located in the web server.

But when you use Visual Studio to create ASP.NET project and web pages, Visual Studio creates several files for you. Let us look at the solution explorer of the sample project we created in the previous chapters.



The solution explorer shows the following files:


  • AssemblyInfo.vb
  • Global.asax
  • Styles.css
  • Web.config
  • WebForm1.aspx


We will learn more about each of the above files later. Now let us go to the folder 'C:\Inetpub\wwwroot\WebApplication1'. You will see the physical files created. Here you can see more files than what you see in the solution explorer.


  • WebApplication1.vbproj
  • AssemblyInfo.vb
  • Global.asax
  • Global.asax.resx
  • Global.asax.vb
  • Styles.css
  • Web.config
  • WebForm1.aspx
  • WebForm1.aspx.resx
  • WebForm1.aspx.vb


WebApplication1.vbproj is the project file. This file is not visible in solution explorer. The project file is just a list of other files included in the project. When you double click on a project file in windows explorer, Visual Studio will open the file and find out the list of files included in the project. Then it displays those files in solution explorer.

If you like to see the contents of the project file, open WebApplication1.vbproj in notepad. If you can understand the format of the project file, you can even edit and make changes it in notepad. Remember that you alter the content of the project file, it may get corrupt and will become useless. So, edit the project file outside VS.NET only after you become an expert!

The files shown in brown font are not visible in solution explorer. Why? Those are files depending on other files. The file Global.asax.vb and Global.asax.resx are related to Global.asax. Similarly, WebForm1.aspx.resx and WebForm1.aspx.vb are related to WebForm1.aspx.

VS.NET hides such related files in the solution explorer so that they are better organized.

If you want to see those hidden files in VS.NET, there are couple of ways.

1. Right click on Global.asax or WebForm1.aspx in solution explorer and select 'View Code'. The .vb file will be opened in VS.NET

2. Click on the project name 'Web Application 1' in the solution explorer. Now click the icon 'Show All Files' in the top portion of the solution explorer. Now the solution explorer view will slightly change and it will show the hidden files also. You can click on the + sign to expand and view all the hidden files. Double click on any file to open and view it in VS.NET



Click on the icon 'Show All Files' again to hide the related files.

Now let us try another thing now. Go to the physical folder (C:\Inetpub\wwwroot\WebApplication1) of our project in windows explorer. Right click inside the folder and create a new text file called 'Hello.txt'.

Now come back to the Visual Studio. Since you created this file inside our project folder, you must be able to view this file in the solution explorer. If you do not see the file, click on the icon 'Show All Files' couple of times to make sure the view is refreshed. You will see the file 'Hello.txt' with a slightly different icon. This indicates that this file exists in the folder, but included in our project. If you like to include this file in the project, right click on the file and select 'Include In Project'. Now the icon will change and the file will become part of the project.

Since 'hello.txt' is a text file, this file will not be compiled. But if you rename the file to .vb or .cs, then this file also will be compiled along with other source files and if there is any compilation error, VS.NET will complain.

Let us learn more about the 'WebForm 1.aspx' in the next chapter.



Next Chapter: Analyze the default web page created by Visual Studio
Previous Chapter: Design mode and HTML mode
More Chapters: ASP.NET Tutorials
More Tutorials: Tutorial Index



Top Contributors
Today
    Last 7 Daysmore...

    Awards & Gifts

    Online Members

    More...
     
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India