Pages

Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

App_Code Folder in ASP .NET 3.5

In Visual Studio Professional 2008, you can still create the App_Code folder by right-clicking on the Web Project and selecting Add, then Add Folder. Rename the new folder to App_Code.

Contrary to some recommendations on the Web that you should not use the App_Code folder because you cannot place common Web UI codes or classes in this folder, you can do so by setting Build Action of each class to Compile. Suppose this step is not done, the classes defined in this folder will not be visible to your other codes. This explains why people recommended against the use of App_Code folder in VS 2008.

Suppose you have a class called WebCommon.cs in this folder. All you have to do is to right-click on this file and select Properties. A properties window will appear. Set Build Action to Compile. Viola! The class can be accessed exactly like what you have seen in VS 2005.

Python and .NET

I was asked to explore using Python with .NET. Here are three possibilities.

Configuration A – Plain IronPython
This is the most straightforward and plain vanilla installation.
Download IronPython-1.1.1-Bin.zip (975KB) from http://www.codeplex.com/IronPython.
Unzip the files into a folder, say C:\IronPython-1.1.1 and set the PATH. Voila!
Type ipy helloworld.py or ipyw helloworld.py

Configuration B – IronPython Studio
IronPython Studio is based on the Visual Studio 2008 Shell runtime (royalty free) and can be installed without requiring any version of Visual Studio. It provides the following templates for projects using IronPython.

Need to first install Visual Studio 2008 Shell (Isolated) (390MB) from http://www.microsoft.com/downloads/details.aspx?familyid=aca38719-f449-4937-9bac-45a9f8a73822&displaylang=en. Make sure you execute the vs_shell_isolated.enu.exe file in C:\VS 2008 Shell Redist\Isolated Mode. If you missed this step, the Iron Python Studio will not work.
Download IronPythonStudio.msi (1127KB) from http://www.codeplex.com/IronPythonStudio. Double click on the above msi file and the installation will start. IronPython is also included in the msi.

Configuration C – Visual Studio 2008 with IronPython
For those who already have VS2008 installed and are working in VS2008 for VB and C# projects, this would be the best configuration. Download Visual Studio 2008 SDK (98MB) from http://www.microsoft.com/downloads/details.aspx?familyid=30402623-93ca-479a-867c-04dc45164f5b&displaylang=en and install it on top of Visual Studio 2008. Run VS2008 under “Visual Studio 2008 SDK --> Tools --> Start Visual Studio 2008 Under Experimental Hive”. On top of VB, C#, C++ and all the project types in IronPython Studio, it also allows ASP.NET web applications and services to be developed using IronPython!



It is difficult to develop GUI Applications without IDE. Since I am a DOTNET guy, I go with Configuration C. Configuration B would be good for those of us who are not using VB and C#. Configuration A in my opinion is not productive, but nonetheless a very convenient way to pick up the basics of Python in .NET.

After some hours of experimentation, there are some serious bugs in IronPython. My colleague reported this problem, create a Button and define a button_click event for the button. However, when a new Label is created, the button_click function is overwritten. Any change made directly to the codes in the code view will most likely mess up the designer view. The Designer View can also be easily "corrupted" even with incorrect indentation.