in

Corey Roth and Friends Blogs

Group site for developer blogs dealing with (usually) Ionic, .NET, SharePoint, Office 365, Mobile Development, and other Microsoft products, as well as some discussion of general programming related concepts.

Kyle Kelin on .Net

May 2009 - Posts

  • Who the Hell Wrote This?

    A colleague yesterday showed me a cool tip with TFS that I would like to pass along. If you have a code file open you can right-click to the left of the code in the gutter, under the source control menu, select the Annotate option. It will open the file up in a new file and show you who wrote that line.

  • Creating a List from a List Template

    I recently struggled with this code and thought I would document it here.

    SPListTemplateCollection listtempColl = web.ListTemplates;

                           SPListTemplate myListTemplate = listtempColl["Random List Template"];
                           web.Lists.Add("MyList", "my list description", myListTemplate );

     

    Pretty simple code. I use the ListTemplate collection of the SPWeb to get a template I have already deployed. I then use that template in the Add method to create the list instead of one of the built in templates.

  • Post Build Actions Are Evil

    This post is in response to the last SharePoint project I was on. Though this wasn’t the first time I have seen this. The developer was using wsp builder and a file called PostBuildActions.bat that was executed when they built their solution. This allowed him and other developers to simply hit F5 to build the solution and deploy it locally to their SharePoint environment. The problems started when the solution grew. It was up to 19 projects when I saw it and most projects had a bat file that was copying assemblies and ascx files after building in order for the wsp builder to work. As you can imagine this was pretty complex and unmanageable. And the build times were over 5 minutes long. Build times this long really interfere with a developers flow. I would hit F5 got get a cup of coffee or minimize the vpc and surf the web. Not a very good use of my time so I decided to cut this down.

    There are three solutions that you could take:

    1. Create additional build modes to Debug and Release

    Use Debug and Release for compile only and create a DebugDeploy and ReleaseDeploy that will then call your PostBuildActions.bat. The does speed up the process because we now can just build if we wanted. But it still to me seemed difficult for a new developer to catch on.

     

    2. Create a manual deploy file

    This is the method I chose. I removed all post build actions and copied those files into one large bat. I ended up creating two bat files, one called buildwsp.bat that copied all the files necessary assemblies and ascx files and included the wsp builder commands to create the wsp file. Next I created a file called deploy.bat that would rectract and redploy the solution package. The process was hit F5, then click buildwsp, then finally deploy. I had the two bat files on my task bar for easy use. This cut down the total deployment to about 2 minutes but it also gave me the flexibility to quickly build in just under 30 seconds.

     

    3. Use MSBuild

    I didn’t use MsBuild in this situation because I didn’t have a lot of time and I don’t know MSBuild. For my next SharePoint project though I am going to use this. I think this could give me the speed and flexibility I have been wanting. There are even some MsBuild templates for SharePoint out on CodePlex.

  • The .NET Framework version 4 cannot be installed because the .NET Framework version 1.0 is already installed on your computer

    I ran into this error message while trying to install the .NET Framework 4.0 Beta. I went into Programs to remove it and it wasn’t listed. Hmmm. So the first thing I did was download this tool:

    http://www.raymond.cc/blog/archives/2008/11/06/how-to-check-what-version-of-microsoft-net-framework-is-installed-in-computer/

    Run in and it will tell you which versions of the .NET Framework you had installed. Sure enough 1.0 was listed. So a quick google search brought me to this tool that removes versions of the .NET Framework.

    http://cid-27e6a35d1a492af7.skydrive.live.com/self.aspx/Blog|_Tools/dotnetfx|_cleanup|_tool.zip

     

    Just a quick note that this comes with no warranty. It worked for me but the cleanup tool is messing with the Registry so do so at your own risk.

2019.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems