Blog Moved ....



my book(s)

my products

July 2006 - Posts

Sloppy (Accidental Source Code) Deployment

All the of the software that I'm in charge of has its source code stored in Vault (from One of the nice features of vault are the shadow copies of files that before they get to/from the client. These are stored in (an automatically created) _sgbak folder. I just noticed that I had over 10,000 files in this _sgbak folder, and went to clean them out. First I was going to just wack the whole directory, but then I thought there might be some files of use, so my second inclination was to delete all files over 60 days, which is the majority of them.

Then my third thought (these all happened in about 2 seconds) was to do a quick online search to see if there was any advice or horror stories about removing these files. So naturally I did a search for the term "_sgbak".

I'm glad that first there is nothing that talks about any harm in deleting these files. But I also noticed that there are a ton of sites online that have these files published.

These files should never be published, because the files themselves are text files that would probably be exposing something you didn't intend to.

I can see how it would be easy to accidentally deploy these files for an ASP.NET application with an easy to do, incorrect drag/drop operation in an FTP client.

Hey Accidents happen -- Do your self a favor and check your production application for any _sgbak folders, and if you find them delete them.

UPDATE {5 Minutes after original post} ....

I just wrote this blog post a few minutes ago, and I thought I'd follow my own advice and do a server scan for _sgbak files. After all, accidents happen. Sure enough, I'm guilty. I am. I found two _sgbak folders on my production server. One was for a set of skins, and one was with a directory of email text file templates. No source code exposed, but still I never intended to deploy these files.

If you use source control, that keeps shadow copies, CHECK YOUR SERVER, I bet you'll be surprised at what you find.


Getting LINQ to work in your new or Exisitng non-LINQ setup project

I read in ScottGu's post the other day that LINQ can also be used under Web Access Projects (aka "WAP"). All the 2.0 sites I build I use the WAP setup for, because I'm addicted to the 1.1 way of doing things.

Anyway, if you install LINQ, one of the wins you get is a new set of LINQ templates in your Visual Studio. This is great if you're setting up a new project, not so great if you're trying to integrate LINQ into an existing project.

So here's what I did, and how I fixed it.

I created a sample LINQ project, and took a look at the auto referenced assemblies. Then I went back to my WAP application, and referenced those assemblies. Then I started my LINQ demo code. All worked well. Generating code from sqlmetal.exe, the inserts, compilation, everything was fast and easy. I can't believe how great LINQ is.

So then my next demo is to start some selects, and using the new LINQ syntax. This didn't get me so far. I found out that there is one more hidden step in LINQifying an existing project. You have to make a minor modification to the MSBUILD commands in your project file. Follow these steps ...

  • Close your project
  • Open your project file in trusty Notepad
  • Just before the closing </Project> node at the bottom of the file add this node
    <Import Project="$(ProgramFiles)\LINQ Preview\Misc\Linq.targets" />

This little gem was the final step (at least so far [knock on wood]) that I needed to LINQify my existing project, and now all is well.

Hope this helps

Posted: Jul 27 2006, 07:05 PM by scott cate | with 1 comment(s)
Filed under: , ,
LINQ Question - Stuck on Compile Error

I'm trying to grab an email address out of an email table.

All the examples show this type of syntax ...

EmailAddress email = data.EmailAddresses.Select(e => e.EmailAddressId == license.EmailToSendLicense);

But I get this compile error.

Error 1 'System.Data.DLinq.Table<Test.EmailAddress>' does not contain a definition for 'Select' 

Thanks for help anyone?

Posted: Jul 27 2006, 03:52 PM by scott cate | with 2 comment(s)
Filed under:
More Posts