ASP.NET Lessons Learned

You do not need an MSI installer to deploy a .NET dll.  Just copy the file.

XCopy can wreck share permissions on a UNC share. I’m not sure why, just know it’s possible.

When shadow copying a .NET website from VSS to a test server, .dll files are excluded and the /bin folder doesn’t get checked in to VSS.  I’ve heard this is ‘a good thing’ although I don’t know why.  Right now I have to manually copy the dll files to the shadow copy.

One quirk about .NET 1.1 is that all pages are compiled into a single DLL.  This means that if one page needs to be deployed, they all need to be deployed.  Alternatively you can use the src page directive, which replaces the inherits directive. This is supposed to force on request compiling.  However, when I try it, all I get are ‘can’t find reference’ errors, even after adding in ‘imports’ commands.  Plus, VS2003 is said to ‘not use’ the src directive and needs to have the imports directive to work, and the ASP interpretor doesn’t use the inherits command, it just uses the already compiled dll.

 

Debugging ASP Classic with Visual Studio 2005

0) Set break points.  You don’t need to click the green arrow, that just sets up the enironment for ASP.NET and wastes your time if you’re just debugging ASP classic.

1) If you use something other than “low isolation” you will be attaching to dllhost.  There will be several, make your best guess.  Most pages will hit break points, but not all.
2)  Better yet, set the isolation level to low, and restart IIS. Attach to inetinfo.exe, there will only be one.  All pages will hit break points and if you aren’t in debugging mode already, everytime you hit an error you will be prompted to start JIT debugging and to select a debugger.

3) This is for a single user development machine scenario.  If there are other developers or live websites on the box, this is probably not adivisable.

Visual Studio for non-Visual Studio Languages

What can be done 

  • VS will let you color sytax if it thinks the file is a C++ file
  • You can use custom snippets for any language
  • You can use external tools to call the external compiler, etc.
  • You can use the VSS integration
  • Create file templates
  • Create project templates

What can’t be done (as far as I can tell)

  • Debug non VS languages
  • Intellisense

However, plug ins do exist that do the intellisense and debugging from the VS environment.

 http://www.jcxsoftware.com/vs.php

Someday I will have to review this product, since all of my personal websites are opensource applications written in PHP. Given I spend $100+ a year on the website, $100 for a development environment that makes PHP development less frustrating might be worth it.  I have very little time for writing code on my personal sites, so every second counts.

Books online is giving me a head ache.

Remember sentence diagraming?

Because query and slicer axes can be constructed from multiple hierarchies of the cube to be queried, these terms are used to differentiate the hierarchies used by the cube that is to be queried from the hierarchies created in the cube returned by an MDX query.

I tried to read this a few times, then my brain exploded.

Visual Studio Database Projects

General Idea
Don’t use SQL Server as your master code repository. You can’t see change histories, you can see when an object was changed, who changed it, etc.  Also, if you are BAD and don’t use default ANSI settings, they will need to be set at each ALTER or CREATE of a stored procedure.  Some tools and developers forget to do this.  Also, if you DROP and CREATE a stored procedure, you will also need to regrant rights on the object, unless you are BAD and have a script that grants EXECUTE to public on all objects every five minutes.

Create a Visual Studio Database Project
All scripts that are needed to create a brand new copy of your database, put into “Create Scripts”

All scripts that tranform your schema from V1.0 to V2.0, put into “Change Scripts”  Capturing these requires either creating them by hand or being diciplined when using tools like RedGate SQL Compare, EM or SSMS.

All scripts that you want to keep out of your server, can’t be turned into a stored procedure, are ad hoc but maybe reusable, put them into “Queries”

Create addtional or different folders if you don’t like this kind of logical arrangement because as far as the project is concerned these are all the same.

Generate Scripts on per object basis
If using EM, generate scripts, per object, don’t use Unicode.  VSS6 can’t deal with Unicode, although VSS2005 can. 

If using VS2003, VS will use enterprise manager to generate your scripts when you drag and drop from the Server Explorer to your Solution Explorer.  This allows for 1 file per object.

If using VS2005, VS will generate the script how it damn well pleases, in one great big file, no questions allowed.  I can’t find anywhere in the Tools Options to change this.

Checking In First Time
 Visual Studio really, really wants to check the project in for you. 

However: Visual Studio will check in in how it damn well pleases.  Checking in a database project creates about 5 layers of empty folders. VSS will also try to check in your solution file, which by default ends up in the My Document Folder.  This implies that the next developer to check out your project will have to recreate your Document Settings tree structure, very non-intuitive.

I say don’t add a database project using the ‘Add to Source Control’  Instead, use the VSS client.  You will get a slew of errors from VSS when you open that project from VSS.  Try Bind and unbind to get them to go away.  It didn’t quite work for me, but with trial and error, things seem to be OK now.

Running the Scripts
Execute scripts either by creating a command file, which runs one or more scripts through osql, or right click on a single command.  If you have SQL2005, use sqlcmd scripts instead, although I’m not sure if the DB project supports them yet.

VS2003/VS2005

You can’t create a table and generate a script for it with anything but the default name.  After all, we know that all good database schemas have tables named table1, table2, table3.  While Microsoft might not know what I will call my table, I think it is safe to say that it will not be table1.  If they can write code to check to see if table1 exists and create a default table name of table2, they can write code to prompt for an intelligible table name.