Categories

Navigation

MVP

Microsoft MVP (since 2006) in the XNA/DirectX category

Tag cloud

Ajax (8) All (206) Arena Wars (21) Boo (4) BroodWar (8) Conferences (1) Development (44) Game Development (142) IronPython (3) Lost Squadron (17) Lua (6) meinSport.de (4) Other (150) Polynapping (12) Programming (156) Racing Game (7) Reviews (76) Rocket Commander (49) Silverlight (10) SQL (1) StudiHelp.de (2) XNA (40)

On this page

All XNA Games converted to XNA 2.0 from Rocket Commander to the Racing Game.
Pics from my new office in Hamburg
Converting XNA 1.0 Projects to XNA 2.0
SQL Tools for synchronizing databases
German: Arbeitsbedingungen in der Spielebranche
Fixing the 'Could not load file or assembly 'xunit, Version=7.10.25.1028'' error
What to do if you receive the System.Runtime. InteropServices.COMException error in Visual Studio
XNA 2.0 released
XNA Game Studio 2.0 beta is now available
Visual Studio 2008 and .NET 3.5 released
Searching for a C#/ASP.NET Programmer for meinSport.de
Lots of Information about XNA 2.0
CoDe Magazine: Microsoft XNA: Ready for Prime Time?
Dungeon Quest Updated with Source Code now
Migrating from Silverlight 1.1 alpha to 1.1 alpha refresh and that lovely AG_E_RUNTIME_ HTML_ACCESS_RESTRICTED error
Silverlight 1.0 RC and 1.1 Alpha Refresh released
VS 2008 and .NET 3.5 Beta 2 Released
Silverlight Error Codes Explained!
Xna Project Changer Tool (with VS 2008 support)
Fixing the Sys.Res. namespaceContainsObject error with ASP.NET Ajax+Silverlight
Silverlight and Web Services
RegionAddin to fix collapsing and expanding regions in Orcas and IronPython region support!
MVP again!
Quick Tip: Getting rid of the "Unable to copy file" error in Visual Studio
FX Composer 2!
Quick Tip: Exclude Files and Folders from Source Control
Debugging Silverlight in Visual Studio
Fixing the "Child nodes not allowed." bug in Visual Studio Orcas under Vista
CodeRush has now VS Orcas support
Fun with Visual Studio Orcas
Using FreeMind to visualize your .txt TODO list
Tools 2007: Using VS Orcas, Multiple monitors, FreeMind, SourceGear Vault, OnTime, Screenshot Captor and StarCraft II
Article in Wired about Dungeon Quest from the GDC 2007
StudiHelp.de Beta Launches
Silverlight and I spotted A Racing Game Mod: Cyber Car
My XNA book is out and XnaProjects.Net launches
XnaRacingGame.com goes online
XNA Racing Game downloads now available on creators.xna.com
Quo Vadis Conference 2007 Photos
Quo Vadis Conference 2007 (die-entwicklerkonferenz.de)
How to allow web services to be called and tested remotely
Unit testing for web sites
Reusing ascx web controls
Annoying Files Remover Tool

Archive

Popular

NormalMapCompressor v1...
CR_Commenter v1.7 Upda...
Reminder: Rocket Comma...
Your Christmas Present...
CR_Commenter Update v1...
The year 2005 - Review...
Seattle Day 3 - XNA Pr...
NormalMapCompressor - ...
Zombie Quest - A new f...
Cool tools
My Bookmarks
CeBIT 2006 Pictures

Blogroll

Projects

Arena Wars (2004)

Rocket Commander (2006)

Pizza Commander (2006)

Rocket Racer (2006)

Coop Commander (2006)

Flower Commander (2006)

Fruit Commander (2006)

Euro Vernichter (2003)

Lost Squadron (2005)

Zombie Quest (very simple 2D Adventure, 2006)

Freifunk Hannover project (GoogleMaps support)

Older projects (2000 and earlier)

MeinSport.de - German Sport Community Site

About

About me: Contact

Send mail to the author(s) Email:

Total Posts: 213
This Year: 0
This Month: 0
This Week: 0
Comments: 434
Made with

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

RSS 2.0 | Atom 1.0 | CDF

My brothers

netfreak.de

mirkman.de

Sign In

 Monday, February 11, 2008
Monday, February 11, 2008 11:48:36 PM UTC (  |  |  |  |  |  |  |  |  )
Even when I did not post much last week I was very busy converting all the old XNA 1.0 games to XNA 2.0. I did not only convert all projects (8 games in total, see below), but I also tested them extensively on Windows XP, Vista (32 and 64 bit) and the Xbox 360. Additionally a lot of usability improvements have been implemented in the games, for example the XNA Shooter is now much easier (was almost impossible to even reach 50% of the level) and a lot more fun due better balancing. The XNA Racing Game has now a better physic engine and will not longer let the car fly out of the track or leave ground in loopings. Due the better input control and fixed physics the cars drive now much faster and it is more challenging to complete the tracks in shorter time frames.

Games in this article:
Please read my previous post about Converting XNA 1.0 games to XNA 2.0 for all technical tips. All the games can also be found on http://XnaProjects.net, but I will also make them easier accessible on this blog soon, which has an update overdue (need to clean up the left and right sides) ^^

Thanks to the great VS2005 support of XNA 2.0 all games have now just one single solution file, which works on Windows and the Xbox 360. The projects can be opened in XNA Game Studio 2.0 and Visual Studio 2005 without having to convert the files over and over again like in the past. The Icons for all games were also improved. Lets take a look at the Icons (.ico files) on Windows:


For the Xbox 360 game icons the .png files (usually named GameThumbnail.png) are used:


Ok, let's take a look at the games and what has changed for them. Most games are pretty much the same as for XNA 1.0, but a lot of smaller bugs were fixed and they have been tested more.

  • Chapter1Game: This application is not really a game, but a test project to check out if XNA 2.0 is properly working on both Windows and the Xbox 360. It is from the first chapter of my book "Professional XNA Game Programming". BTW: The second edition of the book is coming out soon, there are 3 more chapters about Multiplayer game programming and a cool new role playing game.

  • Xna Pong: Xna Pong is a simple clone of the favorite pong game from 1978. It is just a few hunderd lines of code and should be very easy to understand.

    This game is from the book "Professional XNA Game Programming" by Benjamin Nitschke. For more information read chapter 2. (2008-02-10: Now updated to XNA 2.0)

  • Xna Breakout: XNA Breakout is a simple Breakout/Arcanoid game based on the XNA Pong game from the previous chapter.

    It is fully described and covered in Chapter 3 of my book "Professional XNA Game Programming". The code is quite short and should be easy to understand. (2008-02-10: Now updated to XNA 2.0)

  • Xna Tetris: This is a simple, but highly addictive Tetris game. You can control the blocks with your cursor keys, aswd or a game pad and the game works both on Windows and the Xbox 360. Reaching levels above 5 is really hard. My highest level was 9, try to reach more :) (2008-02-10: Now updated to XNA 2.0)

    This game introduces the helper classes (chapter 4 of my book) and makes more use of unit testing and game components in XNA.

  • Rocket Commander Xna: XNA port of the famous Rocket Commander game. The game principle stayed the same, but the controls were a little bit simplified to make it more fun on the Xbox 360.

    If you want to learn more about the Rocket Commander game, check out its official website www.RocketCommander.com and check out the Video Tutorials on Coding4Fun by MSDN. (2008-02-10: Now updated to XNA 2.0, also supports very big resolutions now and runs faster on the Xbox 360)

  • Xna Shooter: Shoot'n'up game specifically created for my book "Professional XNA Game Programming". It features full HDTV support, runs on Windows and the Xbox 360, 5 weapon types, 5 enemy types, a powerful ship and some power ups. It is quite fun to play and it gets harder and harder the longer you play. Based partly on the Rocket Commander XNA engine, but also features lots of new effects and shaders. (2008-02-10: Now updated to XNA 2.0, also much easier and balanced)

    This game and the racing game are the most improved. The game works now much better in high resolutions and on the Xbox 360. But most importantly the game is now much easier, balanced and more fun. Additionally a level percentage is now visible on the bottom and more EMP bombs can be picked up to make it easier at the end of the level.
  • Xna Racing Game: XNA Racing Game Starter Kit I wrote for http://creators.xna.com. More information and more downloads can be found on http://XnaRacingGame.com. It runs best on the Xbox 360 in HDTV (1920x1200), but it also runs fine on the PC. (2008-02-10: Now updated to XNA 2.0, driving also improved a lot, better tested on Xbox 360 and fixed some issues).

    Following things were improved: Shadow mapping on very big resolutions works now (crashed before), more options for lower quality settings, fixed physics, car now always stays on the road, fixed loopings, cars are much faster now, winning conditions work better now, and fixed several other bugs.
  • Dungeon Quest GDC: And finally the Dungeon Quest XNA Game, which was developed in just 4 days on the GDC 2007 at the XNA Contest. Dungeon Quest GDC is a relatively complex 3D role playing game (at least for just 4 days of work). An early version even supported coop multiplayer on the Xbox 360 via splitscreen. The game was developed by Benjamin Nitschke (abi.exDream.com) and Christoph Rienaecker (WAII). (2008-02-10: Now updated to XNA 2.0). This is NOT the full Dungeon Quest game (see www.DungeonQuestGame.com for that), this is just the GDC version.

    Please note that the level was reduced to allow loading on the Xbox 360 (which otherwise crashes with an OutOfMemoryException), the game is not fully playable, only the first part is implemented. You can also press F2 to toggle the Options menu and some minor bugs were fixed. But this game is no longer supported, I will not improve it anymore! Please check out the new Dungeon Quest game from www.DungeonQuestGame.com, which is coming in a month or so.
Have fun with all the games :)
 Friday, February 01, 2008
Friday, February 01, 2008 4:50:16 PM UTC (  |  |  |  |  )
As I briefly mentioned before one of my companies (realis communities) moved to Hamburg and we got a nice new office directly at the Alster sea in the city.

Here are a few pictures to give you an impression. We work here for a few weeks now and are now setteled in.


This is my desk, as you can see, there are a "few" monitors there (and all of them quite big, ranging from 24 to 19 inch). I mainly look at the big 24" in the middle, but also use the other two. On the left side is my laptop, it is not always there, but it is useful from time to time if I need another PC for testing something. But even with this large space (I control everything with 1 keyboard and mouse via the program Synergy), I still have so many overlapping windows. After reading this article (Joining The Prestigious Three Monitor Club) from Jeff Atwood at CodingHorror.com I thought the more space you have the less overlapping windows you should have. But it is more like the more space you have, the more programs you have opened up :) I still use Switcher quite a lot to find the program windows again.


Ok, back to the office, this is one of the other rooms where most of my colleagues sit, currently most of them are away shooting some new video for meinSport TV. They are all nice guys, but you know, no programmers, do I have to say more?


Then there is finally the view out of the window, its still winter, but all that water from the Alster is comforting.

Next I will shoot some photos of my setup at home (more PCs, less monitors, but big ones ^^). I hope this does not bore you.
Friday, February 01, 2008 12:32:32 AM UTC (  |  |  |  |  |  |  |  |  )

When I wrote this (a little bit each day while working on converting the old XNA projects) I was very aware about the disappointment of my blog readers about the fact that I did not blog much in the last couple of months, especially on XNA. I not only got a lot of emails about that, but also quite a lot of questions, especially since XNA 2.0 was released. I made yet another promise to myself to change that and finally blog more, maybe not only when something very interesting pops up, but instead about the everyday issues I run into.

Some Notes about XNA 2.0: More solid, lots of little new features, networking, while it may not be a very complete solution, at least it is now possible on the Xbox 360 and overall I have the feeling even more people are interested in XNA than a year ago. Plus the guys at the XNA Team doing a great job and are constantly improving the XNA Creators Club website for us game programmers and artists :)


Several people had problems using the old XNA 1.0 code of my games and make them work with XNA 2.0, so here is a little help in case you want to convert XNA 1.0 projects to XNA 2.0. You will also notice this if you go to any XNA community site as most samples will still be in XNA 1.0 and not work out of the box in XNA 2.0, and many of those will probably never be changed since they are not longer actively being developed.

For most games almost all of the code can stay unchanged, you just have to poke at a few things that have changed in the framework or were improved. More information about converting projects can be found here (read this first, this article is based on the stuff there). You can also use the Cross-Platform Game Project Converter from XNA 2.0 to add a Xbox 360 project to your existing Windows XNA project without having to create a separate project (it is helpful, but I used pretty much the same trick for all of my XNA 1.0 games anyway).

Let's go through the steps:

  1. Either use the XNA project conversion utility (can be found on the XNA Creators Club website) or just create a new XNA 2.0 project in VS 2005.

  2. If you created a new project, drag all source code files into the project and seperate the content files out and put them all in the existing Content directory (only there the content pipeline is activated). If you just converted a project and the content files did not move, move them yourself to the content directory. Gladly all my projects with more than 5 content files had a special content directory anyway, so no need to change anything content-wise for them. If you don't want some of the files to be compiled to .xnb files, you have to change the build action from "compile" to "content" (and then use the "copy to output directory" switch) or to "none" if you want them to be ignored like for .wav files, which are automatically processed by the .xct (XACT) file for you.

  3. Find the line content = new ContentManager(Services); and replace it with Content.RootDirectory = "Content";. If you do that, get rid of the content manager in your game class since you can now use the build-in Content property to access the underlying Game content manager. In case you don't want to do that or if you need an extra variable, replace the above line with content = new ContentManager(Services, "Content");. Both ways will make sure all the content is now loaded from the content directory instead from the main directory of the application. In more complex XNA games you can also change the BaseGameDirectory to the content directory, but then you would also have to move all other resource files to this directory (config files, save games, levels, etc.). It is usually a good idea to separate the compiled (.xnb) content from the content the user can change (config, levels, etc.), so I suggest just redirecting the content directory of the content manager.

  4. Replace the LoadGraphicsContent(bool) method with LoadContent, remove all the if (loadAllContent) commands (was never false anyway, just let the content of the if loop stay) and also remove the call to base.LoadGraphicsContent(bool) (does not do anything like all the Load or Unload methods in the XNA Game class, they are just empty virtual methods). You can also ignore this and the next step since it will only generate depreciated warnings, but I suggest cleaning up your source code whenever an opportunity like this presents itself. I also added some missing region blocks to the code and some comments here and there were they were missing.

  5. Finally delete the UnloadGraphicsContent method unless it did anything beside base.Unload and base.UnloadGraphicsContent. In my XNA games the UnloadGraphicsContent usually looked like this and can be safely removed now (at least if nothing else is in there):
  6. /// <summary>
    /// Unload graphic content if the device gets lost.
    /// </summary>
    /// <param name="unloadAllContent">Unload everything?</param>
    protected override void UnloadGraphicsContent(bool unloadAllContent)
    {
      if (unloadAllContent == true)
        content.Unload();

      base.UnloadGraphicsContent(unloadAllContent);
    } // UnloadGraphicsContent(loadAllContent)


  7. In case you load sound and music via the AudioEngine, you have to change the directory to the content directory too, which will not be done automatically for you since you load the .xct file directly in the AudioEngine constructor. Basically just exchange the following code:

    audioEngine = new AudioEngine("YourSound.xgs");
    waveBank = new WaveBank(audioEngine, "Wave Bank.xwb");
    soundBank = new SoundBank(audioEngine, "Sound Bank.xsb");

    with:

    audioEngine = new AudioEngine("Content\\YourSound.xgs");
    waveBank = new WaveBank(audioEngine, "Content\\Wave Bank.xwb");
    soundBank = new SoundBank(audioEngine, "Content\\Sound Bank.xsb");

       
  8. In case you have used the StorageDevice and specifically the ShowStorageDeviceGuide helper method, it is gone now in XNA 2.0. I had it in some helper classes, but never actually used it. In case you want to show a save game dialog (or some network game select dialog for example), please follow the XNA 2.0 help instructions to do this asynchronously now.

  9. In case you use any ResourceUsage enum, replace it with TextureUsage instead or remove it if the issue is not texture related. You can also safely remove any ResourceManagementMode.Automatic parameters, which are not longer supported. Everything is now automatic anyway. Just if you have been using ResourceUsage.RenderTarget you will need to change the Texture2D class to a ResolveTexture2D class in order to archive the same behaviour as before. Some calls to the device (e.g. ResolveBackBuffer) have also changed and require a ResolveTexture2D now. You may also want to check if you have any manual texture management or disposing, which you can remove or simplify.

  10. For simpler games (2D) games you should be done now. More complex games using render targets and other features that have changed in XNA 2.0 will require some more changes, but after you have done them once (or know where to change what) this is also a quick process.

The following only applies to the RocketCommanderXna, XnaShooter and XnaRacingGame engines, but you might find similarities with other XNA games and the converting process:

  1. First of all make sure the old XNA 1.1 code gets compileable by going though the changes mentioned above (e.g. replacing ResourceUsage with TextureUsage or BufferUsage) and removing everything that does not exist anymore (like ResourceManagementMode.Automatic). If a method is non-existent in XNA 2.0 like ResolveRenderTarget, comment it out and remember where it happened.

  2. You might go through other issues, but you have to come back to the RenderTarget issue. This took the most time in the converting process for me (probably half of all my issues come by something related to changes with RenderTargets in XNA 2.0). For that reason always make sure that rendering to textures still works while you make changing. I always used the TestCreateRenderToTexture unit test inside the RenderToTexture class to figure things out.

  3. Additionally to making some changes in the BaseGame class (loading content via LoadContent, using the base.Content instead of creating a new content manager, etc.) I also removed all the RenderTarget helper methods and fields from the BaseGame class (SetRenderTarget, ResetRenderTarget, etc.) and moved them into the RenderToTexture class. While this makes the code more clean and restructured by making a few more fields private, if you do not call the new InitializeDepthBufferFormatAndMultisampling of the RenderToTexture class the calls to SetRenderTarget and ResetRenderTarget will not work correctly and will not restore the default depth buffer (which has to be remembered first). If you get the following exception it means the DepthBuffer Device.DepthStencilBuffer was set to null, but is obviously still used. In order to fix that make sure the remDepthBuffer variable is set to a correct value in the InitializeDepthBufferFormatAndMultisampling method!

  4. An error has occurred during the Clear operation while trying to clear the depth or stencil buffer, no DepthStencilBuffer surface exists.
    System.InvalidOperationException: An error has occurred during the Clear operation while trying to clear the depth or stencil buffer, no DepthStencilBuffer surface exists.
    at Microsoft.Xna.Framework.Graphics.GraphicsDevice.Clear(ClearOptions options, Color color, Single depth, Int32 stencil, Rectangle[] regions)
    at Microsoft.Xna.Framework.Graphics.GraphicsDevice.Clear(Color color)

       
  5. 4. Even if you have now done everything, the app may still crash when you are trying to clear a render target (which usually happens at the start of each pre or post screen shader). The reason for the following error is the multi sampling format, which might be set to the background buffer, but not to the render targets:


    The active render target and depth stencil surface must have the same pixel size and multisampling type.
    System.InvalidOperationException: The active render target and depth stencil surface must have the same pixel size and multisampling type.
    at Microsoft.Xna.Framework.Graphics.GraphicsDevice.VerifyDepthRenderTargetCompat()
    at Microsoft.Xna.Framework.Graphics.GraphicsDevice.Clear(ClearOptions options, Color color, Single depth, Int32 stencil, Rectangle[] regions)

       
    In order to get rid of this error without changing the RenderToTexture class a lot, you can just comment out the line where multi sampling is activated in BaseGame:

    //this.graphics.PreferMultiSampling = true;

There are probably even more things that I forgot while converting the projects (converted 8 games and about 15 projects in total now), but the above list should be helpful. Especially for me because I always forget some of those little things and having this checklist is very helpful.

Tomorrow I will probably test all the XNA 2.0 games on my Xbox 360 and make some final adjustments and then post them all on http://XnaProjects.net (and here).

 Thursday, January 31, 2008
Thursday, January 31, 2008 7:10:32 PM UTC (  |  |  |  |  |  )
In the past I usually updated any local database changes directly at the server everytime I uploaded something. If your database is small and the changes occur not very often, this is not a big issue, but once the database grows and especially if you update something here and there very often, it is an absolute waste of time and annoying to do all this by hand. The SQL Management Studio does not really help you out like for example when you are trying to backup data or restore them again. You can connect to two databases, but you can't even have them side by side in a window and you certainly cannot drop anything from one db to the other. You will be able to copy some data from one table into a table of the other db, but that is pretty much about it.

Scripts are helpful, but if you are not a SQL pro and do not want to waste even more time getting involved with that (keep in mind I did most of my SQL coding in either LinQ or some other object releational mapper like EntitySpaces). I checked out some tools a year ago, but saw not really the need to purcase them (especially when you need these tools once a month for 5 minutes and they cost like 500 bucks). I think I bought something cheap and crappy for a few bugs, but it does not work anylonger and did not support my 64bit system. If you do a google search on sql tools you will find a lot of tools, and quite a lot cheap and crappy ones too, probably also quite a few free tools. But the more business related the problem is, the more unlikely it is to find freeware and open source (nobody wants to do this for free). Sometimes I get lucky and find exactly what I'm looking for and it only costs somethink like 19 bucks, then it is ok, even if you use it just for a short while.


Anyway, today I checked out some tools again, first the Teratrax Database Compare tool, which is nice and simple, but does cost quite a bit ($200 per developer). After I entered all the data for both databases it was able to figure out where there are changes, but once I tried to actually synchronize the database schemas (remember, I'm not interested in the data, copying that over is not so hard, I even have some functions in my code that do that) the program stopped and cleared all fields. I checked both dbs and nothing happend. I tried it some more times, but no errors appeared, it just did not work. This was very frustrating.


Instead I went to the next google search result ^^ It was SQL Compare 6 from Red-Gate. I'm already a Red-Gate customer (using the Ants Profiler quite a lot and recently have been using the new Exception Hunter tool), but I always found their SQL tools to expensive for me, especially since I do not do much SQL work (at least I don't want to ^^). Anyway, I fired up SQL Compare after installing their whole SQL toolbelt and quickly entered the connection data for both db connections, clicked next a couple of times, saw some nice statistics and messages and was all done. I checked my local database I used for testing and yes, everything from the other server was there, with default values, descriptions and so on. SQL Compare 6 is priced at around $300, so even more expensive then Teratrax and certainly more expensive than some of the other tools I have encountered. But it works and if I need it again for a few more times in the next 2 weeks (the trial period) I will probably buy it. The amazing thing is that they claim they have already 150 000 customers of the SQL tools, that is quite a lot of money they have generated with some developer-specific-tools. But then again, more than a million people have downloaded XNA Game Studio Express and I would not have guessed there are even so many programmers around (at least I do not see them in the real world, maybe they are all hiding).

Ok, end of story, all the boring database stuff is well again. Also makes generating database code much faster when done locally from a synchronized database instead of pulling the schema from some online server.

 Tuesday, January 29, 2008
Tuesday, January 29, 2008 4:44:20 PM UTC (  |  |  |  |  |  )
A friend of mine (Hi Frederic Schneider ^^) wrote a little article on gameports.net about the work conditions in the games sector, especially about game programmers, designers, artists and journalists. I also answered some questions. It is written in german and may only apply to Germany, but I guess it is not much different in other countries (relative low wages, not a good job security, lots of underpayed interns, long workhours).

Here is the article:

And here is a followup article:

 Monday, January 28, 2008
Monday, January 28, 2008 5:25:26 PM UTC (  |  |  |  |  )
In case you run into the following error:

Could not load file or assembly 'xunit, Version=7.10.25.1028, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
    System.IO.FileNotFoundException: Could not load file or assembly 'xunit, Version=7.10.25.1028, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
    File name: 'xunit, Version=7.10.25.1028, Culture=neutral, PublicKeyToken=null'
    at Xunit.TdNet.TdNetRunner.RunTests(Type type, MethodInfo method, ITestListener listener, TestRunState& runState)
    at Xunit.TdNet.TdNetRunner.RunMethod(MethodInfo method, ITestListener testListener)
    at TestDriven.TestRunner.AdaptorTestRunner.Run(ITestListener testListener, ITraceListener traceListener, String assemblyPath, String testPath)
    at TestDriven.TestRunner.ThreadTestRunner.Runner.Run()
    
    WRN: Assembly binding logging is turned OFF.
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
    Note: There is some performance penalty associated with assembly bind failure logging.
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

This usually just means you have installed a newer version of xunit (in my case 1.0.0.1105), but you also had an older (beta, rc, etc.) version of xunit before, which maybe used the xunit.installer.exe utility to add support to TestDriven.NET 2.x or ReSharper 3.0. Just disable the support with this tool, Visual Studio and TestDriven (or ReSharper) work fine with the new version without that extra tool. In fact you can delete it after you have disabled all options.

Monday, January 28, 2008 3:21:17 PM UTC (  |  |  |  |  |  |  |  )
Hi everyone,

I prepared some new exciting blog posts, especially about XNA and I will post them shortly and also quite a few things will change at this blog. Stay tuned.

Recently one of my companies (namely realis) moved to Hamburg and I have a new PC at the new office, where I installed Visual Studio 2008 and everything else I needed. After I downloaded the latest source code files from Team System, I ran into some problems. BTW: The Team System trial will end next month and I will probably not switch back to SubVersion, but instead go back to Visual SourceSafe since the integration is the best in Visual Studio. Team System is nice to have but absolutely not something important for me as I'm most of the time the only guy using it anyways.

Back to the Problem. After I loaded the main solution the 2 web applications in it were unable to be loaded. The rest of the projects did load fine and worked after a while until I had all the missing Assemblies installed (xunit, Ajax stuff, Silverlight, IronPython, EntitySpaces, etc.). But even after making sure Silverlight and the Silverlight Tools for Visual Studio Alpha was installed and working (checked it by creating a new Silverlight project, which worked fine), I was still unable to load those projects. I thought at first maybe something went wrong when I checked in or out all the files, but after testing it on my laptop this was not the issue, all files are intact. Everything worked just fine on my laptop, where I had done most of my work during the move and first weeks until everything was finally working here.

After digging around a bit I went back to the IIS were those 2 websites should run on and they did not run yet (not compiled yet, no wonder). But even after I pointed to some dummy website the IIS did throw out some errors (first some dlls were missing, they were quickly replaced, then some security issues with Vista, also easy). Then I pointed back to the location of the projects and made sure IIS was working this time. Now I could go back to Visual Studio and finally load the web projects.

If you have such a InteropServices.COMException, try to see if you have missed something like the Silverlight Tools for Visual Studio Alpha and then figure out if your IIS is working. You can also edit the .csproj file and remove the references to IIS at the very end of the file to see if the project can then be loaded (using IIS again is not hard through the project properties).

Hope this helps (phase stolen from ScottGu, btw: really cool stuff going on over there, the ASP.NET MVC framework is nice and the .NET Framework SourceCode is very helpful!)

 Thursday, December 13, 2007
Thursday, December 13, 2007 8:35:44 AM UTC (  |  |  |  |  )
As mentioned here in the official press message from Microsoft XNA 2.0 was released today after a very short beta phase which did only run for a few weeks.

You can download XNA 2.0 from Creators.Xna.Com, but for now it just says "XNA Game Studio 2.0 will be available early morning, Thursday Dec 13th, 2007 PST.". This will hopefully change soon ^^

http://creators.xna.com/Education/GettingStarted.aspx

Since XNA 2.0 is now out I will talk about some of its new features shortly and comment a little bit about the new networking API and Xbox LIVE features. Stay tuned.
 Tuesday, November 20, 2007
Tuesday, November 20, 2007 12:24:41 PM UTC (  |  |  |  |  |  )
The long awaited XNA Game Studio 2.0 beta is now available and can be downloaded from the XNA Creators Club website: http://creators.xna.com/beta/betahome.aspx

My first impression of the new multiplayer API is not that good. While it is very nice to have the ability to use networking on the Xbox 360, it is not only too hard to make it work on just a Windows PC and secondly you cannot expect that your gamers will both have a Xbox LIVE Gold membership AND a XNA Creators Club membership (both cost money). This means if you really want to do networking on a Windows XNA 2.0 game, you have to use System.Net and write it all yourself or no one will ever play your game on Windows except some XNA developers maybe.

Other than that XNA 2.0 is a great improvement, but it does only work with VS2005 yet, maybe they missed the VS2008 release earlier yesterday ^^ But it will probably be possible to modify the .csproj files again to make it work in VS2008 (without the extra XNA features and content pipeline).

 Monday, November 19, 2007
Monday, November 19, 2007 7:59:45 PM UTC (  |  |  |  |  |  )
Great news from ScottGu's blog: The final Visual Studio 2008 version and .NET 3.5 were just released :)

I have been waiting the whole day and kept refreshing the MSDN page, but I could not really believe that they actually ship today ^^

VS 2008 will probably not be much of a change for me because we have been working with the VS 2008 betas for over a year now.

I might also blog a little bit about IronPython, which I have used for smaller projects and plan using for bigger stuff in the future too. The best feed for IronPython News is: IronPython Url's

Btw: Pretty quiet on my blog for a while now, I should continue blogging. Always being too busy to write anything here is not a good thing. Gladly all my current projects work really good and are still fun to maintain, even as they grow bigger and bigger.

Update 2007-11-20: I have to say the ASP.NET Designer in VS2008 is really good again. The designer did not work well for most of my projects in VS2008 beta 2 and it was always annoying to have the million ASP.NET errors poluting the ErrorList (now they are just warnings and can easily be switched off). Overall I'm very pleased with the VS2008 so far, uninstalling VS2008 beta2 was a bit of work, but everything is working nicely now. More info and improvements in VS2008 can be found on ScottGu's blog

 Tuesday, September 04, 2007
Tuesday, September 04, 2007 7:29:32 PM UTC (  |  |  |  |  |  )
Warning: Shameless plug ahead.

We at realis communities (german community website builder company, bla bla, see links at the right side: meinSport.de, StudiHelp.de) are searching for C#/ASP.NET Programmers right now. Since we are a german company and the following is posted on german job sites, you probably won't understand it if you can't read german. Anyway, feel free to send us an application if you are interested (and skilled of course ^^).



And the same thing as a word document:
SearchingForMeinSportCoder.doc (216.5 KB)
 Thursday, August 16, 2007
Thursday, August 16, 2007 8:59:02 PM UTC (  |  |  |  |  |  )

Ziggyware has a good overview of the XNA 2.0 announcements and GameFest conference sessions in the following post. Check it out if you are interested in the new XNA 2.0 features (mainly networking, which is really a big step forward). It is also nice to see so many new XNA games and development efforts :)

http://www.ziggyware.com/news.php?readmore=407

 Thursday, August 09, 2007
Thursday, August 09, 2007 6:43:04 PM UTC (  |  |  |  |  |  |  )
Microsoft XNA: Ready for Prime Time?

is the name of the Article of the CoDe Magazine. It is very well written and a really long (9 pages) read with tons of information in it.
Together with 6 other guys I was interviewed about my experiences with XNA and the development process of the
XNA Racing Game and Dungeon Quest, which are 2 of the best looking XNA games so far :)

Check it out, good work Nick Landry.
 Tuesday, July 31, 2007
Tuesday, July 31, 2007 6:35:30 AM UTC (  |  |  |  |  )
Hey! Finally some News about Game Development again. All this Silverlight and VS2008 stuff is nice, but XNA has become pretty popular recently (lots of posts in blogs, more articles everywhere and a lot more news).

Anyway, I wanted to release the Dungeon Quest Source Code for several months now, but I never found the time to package everything up, do some cleanup and release it. Recently some people have requested the source code and emails keep coming in. To finally make everyone happy, here is the new Dungeon Quest version with some nice additions, much cleaner code with quite a lot of refactoring and some nice unit tests (see below). This version also does not require PS3.0 anymore, you can now run Dungeon Quest on a PS2.0 graphic card!

First of all: The downloads, all of them can be found on XnaProjects.net too:
  • DungeonQuestSetup.exe (40 MB): Game installer for Windows with everything you need to play.

  • DungeonQuestSourceCodeAndContent.zip (103 MB): Full Dungeon Quest source code with all content files.
    Please note that the collada files (xml text format) and the sound/music are very big (extracted ~200 MB).
    This download also contains the full game in the bin/debug/ directory, you only need to download this file
    for development and testing.
    Contains solution and project files for VS2005, VC# Express (XNA Express) and Xbox 360!

  • DungeonQuest.wmv (21 MB): Higher quality version of the YouTube video below

Here is the good old YouTube video from the game to give you a first view if you don't know about Dungeon Quest yet.



If you want to drive into the source code I highly recommend starting all the unit tests in Program.cs after checking out the directory structure of the project:

  • UIManager.TestUI();
    Show the graphical user interface of the game (boxes for health, player values, rpg levels, etc.)

  • ShaderTests.TestNormalMappingShader();
    Test the normal mapping shader, for more shader tests check out the XNA Rocket Commander and XNA Racing Game projects.

  • ColladaModel.TestCaveColladaModelScene();
    This tests the big cave collada file (80 MB) and renders it with the cave shader. Looks very nice.

  • ColladaModel.TestLoadStaticModel();
    This is straight from the SkiningColladaModelsWithXNA project from February. This test show shows a static collada model.

  • AnimatedColladaModel.TestPlayerColladaModelScene();
    Also from the SkinningColladaModelsWithXNA project. This shows the player or the goblins running, dying, staying, etc.
    This is a useful unit test to test animations for skinned collada models.

  • PostScreenGlow.TestPostScreenGlow();
    Test post screen glow, more details can be found in the Rocket Commander tutorials and most of my XNA projects.

  • PlaneRenderer.TestRenderingPlaneXY();
    Test to render a plane on the ground, which is also used in some other tests. Also good for testing shaders.

  • ShadowMapShader.TestShadowMapping();
    Test Shadow Mapping unit test, pretty complex stuff, but kinda nice for this game. More details can be found in my book, this is a complex topic and involves a lot of finetuning to get it right.

  • EffectManager.TestEffects();
    Since DungeonQuest uses some effects for fire, smoke, blood, etc. it has a simple effect system build in. Use this test to see whats possible and to extend the effect system.

  • StringHelper.TestConvertStringToFloatArray();
    An example of a dynamic unit test, which can also be started from NUnit or TestDriven.Net (right click if you have the addin installed).

  • Sound.TestPlaySounds();
    And another test to play the sound effects used in the game, just press A, B, 1, 2, 3, etc. to play sounds.

  • ColladaModel.TestCaveColladaModelSceneSplitScreen();
    This test shows how the engine supports split screen support, but it was never fully implemented into the game itself yet.
    To finish this the game logic + handling input from 2nd player has to be implemented.

Some Screenshots from the last post on my blog about Dungeon Quest:


Ok, let's get started. What is this guy doing there. He doesn't look very friendly, maybe it is better to hit him in the head!


First quest completed. This key is important to open the door to the second level.


Nonstop fighting action. Well, at least if you don't lose your way.


This is how it looks like after I got angry. I told those guys, don't start any fights!


Ohh no. I did not use all my skills (see right side) and this Ogre killed me too quickly. I guess I have to start over.


The credit screen when the game ends. Notice my book :)


No reason to stop, let's start over and try again. The fight is continuing. The game is not that hard, you just have to use all skills and avoid being hit by fireballs or big enemies when you have low hit points.

I hope you like Dungeon Quest and that the source code can be useful for your XNA projects. Enjoy!

 Sunday, July 29, 2007
Sunday, July 29, 2007 6:57:29 PM UTC (  |  |  |  |  )
When you have some Silverlight 1.1 alpha code and want to use it with the new Silverlight 1.1 alpha refresh bits, you should make sure to replace all assemblies and recompile any libraries you have. You still might get quite a few errors because of some minor changes in the javascript code. I haven't fixed all issues yet, but the main one was replacing the Silverlight.js and fixing the .js files for html (or aspx) pages to the new syntax. Sys.Silverlight is now just Silverlight, the version is now not longer called 0.95, but 1.1 and enableHtmlAccess has to be set to "true" instead of just true before.

When you get the 2211 error code with Silverlight 1.1 alpha refresh with that nice AG_E_RUNTIME_HTML_ACCESS_RESTRICTED error follow this steps:
  • Replace Silverlight.js with the newer version from alpha refresh (you probably have done that already)
  • Replace Sys.Silverlight.createObjectEx with Silverlight.createObjectEx in all your .js files
  • Also replace all version="0.95" with version="1.1" in all .js files!
  • Finally replace enableHtmlAccess: true with enableHtmlAccess: "true"
    This change is very important and will finally get rid of the Html access restricted error above.
    If you like the error, you can "enable" it again by setting enableHtmlAccess to "false" ^^

There are probably much more little changes and fixes, but this should get the simpler pages up and running again.

Sunday, July 29, 2007 12:43:40 PM UTC (  |  |  |  |  |  )
After VS2008 beta 2 is available now, Silverlight was also updated. For Javascript development the Silverlight 1.0 RC means you are not longer in beta mode and the version will stay the same. For .NET development Silverlight 1.1 is still in alpha, which propably means there are still a lot of features missing, a lot of bugs in there and it is still hard to work with it. However, over 2000 bugs where fixed since the Silverlight 1.1 Alpha release 3 months ago.

For Silverlight designers: Blend 2 was also updated to an August CTP, a lot of small improvements here too. The best thing here is the ability to create and compile user controls and some nice changes to the Storyboard editing process.

Download links:
Seen first on:
Scott Guthrie also has a nice blog entry about VS2008 Intellisense improvements, a lot of small improvements, which might impress you if you have never used Resharper and CodeRush before. It is always nice to see the overall coding experience becoming easier, even if it is in small steps.

 Friday, July 27, 2007
Friday, July 27, 2007 4:52:59 AM UTC (  |  |  |  |  |  )
Great News, read all about it on Scott Guthries Blog:
http://weblogs.asp.net/scottgu/archive/2007/07/26/
vs-2008-and-net-3-5-beta-2-released.aspx


It features major improvements to ASP.NET Ajax, Linq, the build in Webdesigner and CSS/Javascript.
Seems like nothing for Silverlight yet, still awaiting some updates there :)

Have to check VS 2008 out now ^^

 Friday, July 20, 2007
Friday, July 20, 2007 11:49:28 PM UTC (  |  |  |  |  |  |  )
Side note: FX Composer 2 RC1 is out. Check it out, works even better now.

I worked a bit with Silverlight 1.1 (alpha) over the last few weeks and I noticed a lot of annoying
javascript error messages with just stupid error codes and no stack trace for the exceptions.
This is definately the worst thing about Silverlight, you have to do a lot of trial and error testing,
unit testing and debugging silverlight is also hard to do.

I wrote down all the errors I have encountered and some solutions to them, which might be
helpful to other people coding Silverlight too. Now whenever I get an error I just look into this
list and follow the steps from top to bottom and this way I save a lot of time ^^ maybe I will
also rewrite the javascript on_error code that throws these errors to a more useful version.

Silverlight Error Codes:
  • 1001: usually AG_E_UNKNOWN_ERROR (yeah, thats really helpful)
  • some element is null while loading a control
    Fix: Check all controls constructors and fields, set breakpoints there!
  • Namespace duplicate found (usually error code 2254)
    Fix: Check all namespaces, make sure each name and namespace is only set once

  • Control has no default Constructor and can't be instantiated
    Fix: Provide a default constructor with no parameters, it can be empty!
  • NullReferenceException (or other exceptions) happend somewhere
    (usually in the Control constructor somewhere)
    Fix: Catch the exception or set breakpoints to find it, then fix it.
    Often it is also useful to comment code out and test if it works again.

  • If this all not helps and the 1001 errors keeps coming up when you use the
    control use the following approach:

    Fix: Comment out the control, the page should now work.
    Comment it in again and check every single property you set, try removing
    as much as possible and test again. If it still does not work, check out
    the control itself, comment everything out here inside the control canvas.
    It should work now except for some errors of missing inner control names.
    Now slowly comment everything in again and try to see which inner control
    did not work. Often a depreciacted, commented out or deleted property is
    used and causes this error. Again try to work with as little as possible
    control properties and increase until the error pops up again.

    This more complex case will hopefully not happen to you in the beginning,
    but the more controls you build, the more likely it is that this one
    will annoy the hell out of you. Keep calm and go forward as methodically
    as possible, it will also help you for future error encounters.
  • Can happen if a TargetName for a Storyboard (or something similar) cannot
    be found. Make sure the target control name is still valid.

  • 2005:    ParserError: Unknown namespace xy
  • The line should tell you which namespace is unknown and this should
    be quite easy to fix. It usually means you have either forgotten to
    add a namespace or add an element into an unsupported location.
    E.g. adding something to a nested Canvas can sometimes cause this error.

  • 2024: ParserError:
  • Invalid attribute value text/python, usually happens in the main xaml file.
    Similar to 2265, use the same fixes.

  • It can also happen when the mime type
    is not available (e.g. in IIS) and .py files can't be used.
    Fix: Define .py as mime type in IIS as 'text/ironpython'
        
  • 2101: can be:
  • LostFocus event (or similar) not supported here
    Fix: Move global events to the main canvas, they are only supported there!

  • 2207: AG_E_RUNTIME_METHOD
  • playing media failed, unable to play it, loading probably failed with 403
    or 404

  • 2210: AG_E_INVALID_ARGUMENT
  • Short: In 90% of your cases the embedded resource cannot be found, make
    sure that the name of your embedded resource is correct in the
    GetManifestResourceStream function in your control constructor. Also make
    sure the file is marked as an embedded resource in VS Orcas!
  • This means the embedded resource could not be found, which means either the
    call to GetManifestResourceStream uses the wrong string OR the resource
    is just not existant because of a wrong content type! make sure the
    control you are trying to access is actually an Embedded Resource and not
    just a Content or Silverlight Page.

    Fix: Set control xaml as Embedded Resource and make sure all strings are
    correct! GetManifestResourceStream should succeed! Using the Silverlight
    1.1 API UI Controls is also helpful because they figure out the path
    for you (just leaving you with misstyping the control name or forgetting
    to set the embedded resource type or one of the million errors below).

    Note: This is very annoying because SourceControl sometimes messes this up
    and just merges 2 files and setting it as Content or Silverlight Page,
    which make this error hard to track, so always check for the correct
    file build action first, it should always be Embedded Resource for controls.
  • Another way this error can happen is when inside the control a namespace
    error occurs (similar to 1001 or 2254), you just get 2210 and trying to
    find why it does not work while all names are set ok and the resource is
    found, etc. One example of this failing is that a namespace or assembly
    used inside a control to reference other controls cannot be found or is
    misspelled (e.g. path does not longer fit, can be stupid things like
    ClientBin/Some.dll should be ../ClientBin/Some.dll)

    Fix: Check all namespaces in the control too, make sure all names are
    correct and files (especially assemblies) can be found the way they
    are specified!

    Advanced Fix: I use reflection to find out about the class name and use
    that same name for the .xaml file, this way I never have to specify
    any name and merging files does not lead to problems as long as the xaml
    file has the same name as the class (which is easy to spot in VS Orcas).
  • Another VERY crazy way for this to happen is when one of your controls is
    using the partial keyword for its control class and overwrites some of the
    autogenerated background fields (through x:Class in the main Canvas of the
    control), it is probably better to always remove the partial and make sure
    the control is all managed by you (like in the SDK samples).

    Fix: Remove the partial in c# and the x:Class in xaml if you get compile
    errors, after that it usually just works :)
  • Older notes (before I figured this out):
    Seems to happen with perfectly fine xaml code, no c# breakpoint is ever
    hit, so this must happen while parsing the xaml. Often also changes to error
    2254 if some name or namespace is wrong, but then gets back to 2210 if that
    is fixed.
  • Someone here traced the 2210 back to “InitializeFromXaml” being called
    with an invalid resource stream (GetManifestResourceStream), which failed
    one line above it:
    http://silverlight.net/forums/t/1755.aspx
    
  • 2251: ParserError, AG_E_RUNTIME_MANAGED_ACTIVATION
  • Probably a security issue, seems to happen on a Max when the xaml file
    could not be loaded or accesses something that is not available (assemblies)
    Fix: Seems to be a Mac bug, will hopefully be fixed in the future.
        
  • 2252: can be:
  • Canvas Load Error, canvas could not be loaded because something is wrong
    it may help to check out the line and error description for more details.
    Fix: Look through the xaml line by line, annoying, but something is wrong
  • AG_E_RUNTIME_MANAGED_ASSEMBLY_DOWNLOAD:
    When this happens the control at the line specified failed to load.
    This can be because it crashed somewhere in the constructor, setting a
    breakpoint usually tells you wether it crashed in C# or already in the
    xaml. If it is in the xaml, you have to figure out the error there (try
    to uncomment, check namings, etc.). If it happens in C# setting a
    breakpoint makes it much easier, but the error is still annoying. For
    that reason you should make sure to test your controls as much as
    possible before using them on a complex page.

    Fix: Set a breakpoint in the constructor of the control and fix the
    exception! Or if that does not help, take a close look at the xaml
    and comment it out to see what works and what does not.
  • More help about 2252 from http://silverlight.net/forums/t/370.aspx
    Assembly loading failed, this can happen because of the IIS being
    misconfigured (unlikely if you doing development) or because the
    path to the assembly could not be found (much more likely).

    Fix: Make sure both the page xaml and the control xaml point to the
    correct directory for the dll and make sure this works from the
    perspective of the page, not the directories the xaml files are in!
    In my case changing ClientBin/.dll to ../ClientBin/.dll often did
    the trick!
  • Another issue can happen when you rename the assembly, but not all the
    .dll links are correct. It can also be problematic if there are special
    letters like - in the assembly, which will get renamed to _, but the
    filename is still with -, see here:
    http://silverlight.net/forums/t/370.aspx

    Fix: Just check all .dll links and make sure both the name and the path
    are correct.
        
  • 2254: AG_E_RUNTIME_MANAGER_ASSEMBLY_DOWNLOAD, can be:
  • Control type not found because a namespace is not set correctly, this can
    happen if you just copy a file from another project and do not change the
    namespace accordingly.
    Fix: Make sure all namespaces are correct (same in xaml as in the controls)

  • Namespace duplicate found, make sure that all namespaces and names only
    occur once.
    Fix: See above 1001
        
  • 2255: AG_E_PARSER_BAD_TYPE
  • An unsupported type was found, which usually means you are specifying a
    control or class for the xaml, which does not exist (anymore). Make sure
    that the x:Class parameter points to an existing class and uses a correct
    namespace.
  • Also seems to happen when there are multiple comment blocks mixed in the
    xaml file or some name contains an invalid character because of that.
    Clear the xaml file and test until it works again, then insert the removed
    code again to figure out where the error is happening. The line/position
    information of this error is usually not very helpful!
        
  • 2265: Error: Parser code
  • Parsing xaml failed, this has been reported after saving some xaml in Blend
    but it could not be parsed in Visual Studio.
    Fix: Try using only parts of the xaml, use smaller files, dunno.

  • Parsing xmal failed, some syntax error.
    Fix: You should be able to spot the error and fix it if it is a smaller
    file, for bigger files comment most of it out and comment it back in until
    it breaks again. Then fix the issue.

  • 3001: AG_E_INVALID_FILE_FORMAT
  • Often a ImageError, which usually means you are trying to load an
    unsupported image format like the .GIF format, which is not supported
    by Silverlight yet.
    Fix: Use .PNG instead of .GIF, etc.
        
  • 3002: AG_E_NOT_FOUND:
  • Error type should describe which kind of resource was not found (usually
    ImageError). Check your constructor and Page_Loaded methods and check
    all the files that are loaded there and make sure they exist. This is
    probably the equivalent of FileNotFoundException, just all the helpful
    information (which file, why, etc.) is missing. Sometimes the error type is
    confusing because it may report an ImageError, but in reality just the xaml
    file could not be loaded, always check the xaml file (name, loading, etc.)!
        
  • 3010: can be:
  • Silverlight installation is not complete yet, restart browser (or computer
    if this error persists).
    Fix: Tell user to restart browser.

Link to the silverlight.net forum (post this here too), 13 known issues
with Silverlight 1.1. It is good to know them:
http://silverlight.net/forums/t/2400.aspx

Other helpful links:
http://blogs.conchango.com/stevenevans/archive/2007/06/06/
Silverlight-Adventures-with-Blend.aspx

http://www.thescripts.com/forum/thread650457.html
http://silverlight.org/forums/t/1422.aspx

Note: I will add more errors to this list for Silverlight 1.1 alpha, but I will probably just
write a new blog entry for newer Silverlight versions. Still pretty excited about the new
VS Orcas Beta 2 release ^^

 Thursday, July 19, 2007
Thursday, July 19, 2007 3:21:43 AM UTC (  |  |  |  |  |  |  )
I wrote a little tool almost a year ago to help me coding XNA directly in VS 2005 instead of using XNA Game Studio Express, which does not support addins. I wrote a little bit about that back then, but for some strange reason I never published my tool. I also wrote about it in my book "Professional XNA Game Programming" in chapter 1 at the end.

Recently I got some emails requesting this tool and I still had to test it for the final XNA version and I also want to add support for VS 2008 (also called orcas; vs 2008 beta 2 comes next week hopefully, yay!).

This tool does not do much, but it is still very useful like the AnnoyingFilesRemover. I use it almost daily when developing and testing XNA projects. It converts projects from VS Express to VS 2005 and VS 2008 and back, you can also use it for VS 2008 (Orcas) projects, which can be openend in VS 2005 again (and compile if you don't use .NET 3.5, but even that works to a certain degree with the LINQ May 2006 CTP). I will try to update this tool when newer versions of XNA (like the XNA Game Studio 2.0) and VS 2008 (like the beta 2 next week) come out, exciting times are ahead :)

The tool looks like this, the most useful button is "Save and Open Project", which convert and then starts the selected VS version:



And here is the installer plus source code:

PS: VS2005 and VS2008 both do NOT support the XNA Content Pipeline. I suggest just starting to write XNA games in VS2005/VS2008 and then switch to XNA Game Studio Express when you need and want to use the content pipeline (or use a library in VS2005 and write the game with XNA Game Studio Express).

You can also use the also use the XNA Content Builder to create .xnb files yourself:
http://www.codeplex.com/xnadevru/Wiki/View.aspx?title=XNA%20Content%20Builder%20(XCB)
 Tuesday, July 17, 2007
Tuesday, July 17, 2007 6:58:07 PM UTC (  |  |  |  |  )
When you try to implement a Silverlight project into an existing ASP.NET Ajax
website you will just click Add Silverlight link to a specific directory in your
website (don't spam everything into your main directory). Then you might want
to use same the html code from your test sites in the ASPX page, like this:

<head runat="server">
  <title>Some title</title>
  <script type="text/javascript" src="Silverlight.js"></script>
  <script type="text/javascript" src="Default.aspx.js"></script>
</head>


And the SilverlightControlHost somewhere in the body (in the form).
You also might want to move the body onload method to a div panel in case you
are using a master page or you want multiple silverlight controls:

        <div id="SilverlightControlHost"
            onload="document.getElementById('SilverlightControl').focus()">
            <script type="text/javascript">
                createSilverlight();
            </script>
        </div>


You might be able to compile and start that without any problems, BUT if you
already have a lot of ASP.NET Ajax code you might end up with this error (and
a bunch more, most of them with Sys.Res in the error description).

Line: 967
Error: Sys.Res.namespaceContainsObject is null or not an object



The problem is that both Silverlight and some generated ASP.NET Ajax javascript
files use the same javascript object (Sys.Res), but overwrite it and disable the
functionality that is needed. You won't find much information on that with
google, but the solution is very simple! Just put the scripts directly into
your ScriptManager of the site like this and remove the scripts from the header:

        <asp:ScriptManager ID="ScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Path="Silverlight.js" />
                <asp:ScriptReference Path="Default.aspx.js" />
            </Scripts>
        </asp:ScriptManager>

        
Hope this helps and saves you some time.
 Friday, July 13, 2007
Friday, July 13, 2007 8:58:58 PM UTC (  |  |  |  )
Using a webservice in silverlight can be very problematic. It does not work out of the
box when you just add a web reference and try to use it. You will get a lot of
501 - Internal Server Errors, WebException - Error invoking service, etc.

Instead of repeating what so many people have already reported for Silverlight
and Web services I will just link to them and give you a small comment about
each link. My solution is below (it was something completely different than
the links I present here, but maybe I did not read all of them carefully).

Links:
  • Silverlight documentation about using remoting and webservices. Two solutions are presented, but the help is very short and if you have not done it before there can be many problems that are not discussed here. But this two ways are the standard solutions that almost everyone uses.
    http://www.silverlight.net/QuickStarts/Remote/default.aspx



  • I used another solution to put all websites, web services and silverlight projects onto my IIS 7 server in Vista x64, but I had troubles debugging them. I moved also to IIS because it was annoying to test the website with the fun crashes VS Orcas gives you from time to time and it also has the advantage to show a working version on your colleagues computers by pointing to your computer's IIS.





        In short this is what I had to do to get debugging and executing working for web sites and web services in IIS7 with VS Orcas:
  • Install IIS (Internet Information Services) first, you can find it in the Control Panel -> Programs/Features -> Turn Windows features on or off.
  • Open the IIS tree and select the Web Management Tools (just install all of them). Also make sure you install ASP.NET in World Wide Web Services/  Application Development Features, it will also select all the other required components.
  • Last but not least select the Basic, IP, URL and Windows Authentications in the Security tree below World Wide Web Services.

  • After installing it you probably need to restart (it did not work without restarting at my colleagues computer). With the IIS Manager (in Computer Management) navigate to your Default Web Site and go into Authentication. Only Anonymous Authentication will be enabled, also enable Windows Authentication (and whatever else you need). You should also switch from the Default AppPool to the Classic .NET AppPool in the Default Web Site -> Right Click -> Advanced Settings -> Application Pool, else debugging will probably not work (Ctrl+F5 works fine even when you do not do this).
  • All websites you create from now will use the Classic .NET AppPool, if you already have websites in IIS, make sure to change them too if you want to debug them.
  • If you still cannot debug you probably do not have sufficiant rights for the user account that is used in IIS. I usually create a new account with Admin rights (plus password), set it to the IIS (Anonymous Authentication, click edit to select a new user) and then downgrade the Account until it does not work anymore, then you can set the appropriate rights (directory access, etc.) to the account. If you only use your IIS for yourself, you can also use your own user account for testing and debugging.




My problem however was the inability to access the web service via HTTP.
You can access it via SOAP and call the main page and execute the methods,
but directly calling Service.asmx/Method?Parameter=Value was not possible
and lead to the:
WebException - Error invoking service
and Internal Server Error
exceptions (depending on the mood and the way I used web services, I used
mainly the first method (Plain XML Requests over HTTP) as described here:
http://www.silverlight.net/QuickStarts/Remote/default.aspx

To test this I called the website directly the way described in the article
I used something like this:
http://localhost/TestService/Service.asmx/HelloWorld?SomeText=Hi
This returned a 501 Internal Server Error (IIS7) or 404 The Page cannot be found
(IIS6), which means this kind of HTTP gets is not supported in this web service
right now. To fix this you have to activate HTTP get in the web.config file with the following code:
    <webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>

From the MSDN Help on activating HTTP Get and HTTP Post for web sites and web services.
http://support.microsoft.com/default.aspx?scid=kb;en-us;819267

Hope this helps, make sure to read the articles mentioned above in detail if you still have issues.

Update 2007-07-14: BTW, if you are interested in webservices for ajax and silverlight,
check out this new project from microsoft live labs:
http://astoria.mslivelabs.com/
From the astoria website: "The new wave of web applications are built on technologies such as AJAX and Microsoft Silverlight that enable developers to build better, richer user experiences. These technologies bring a shift in how applications are organized, including a stronger separation of presentation from data.

The goal of Microsoft Codename Astoria is to enable applications to expose data as a data service that can be consumed by web clients within a corporate network and across the internet. The data service is reachable over HTTP, and URIs are used to identify the various pieces of information available through the service. Interactions with the data service happens in terms of HTTP verbs such as GET, POST, PUT and DELETE, and the data exchanged in those interactions is represented in simple formats such as XML and JSON.

We are delivering this first early release of Astoria as a Community Tech Preview you can download and also as an experimental online service you can access over the internet."

 Monday, July 09, 2007
Monday, July 09, 2007 6:19:33 PM UTC (  |  |  |  |  |  |  )
I've been working with VS Orcas for 3-4 months now and while most projects are still in C#, I switch over to IronPython more and more, especially if I do anything new like some Silverlight website.

CodeRush is working ok in VS Orcas, but there are still some issues, for example expanding/collapsing regions like in my CR_Commenter plugin does not work at all. Visual Studio's Ctlr+M+M and Ctlr+M+L work, but they are pretty much useless because they either collapse just the most inner region (Ctrl+M+M) or just too much (Ctlr+M+L) and pressing these hotkeys is too complicated anyway.

With CR_Commenter you can press Ctrl+4 to collapse or expand the region you are in or Ctrl+5 to collapse/expand all regions (but not summaries, methods, etc.). This works fine in VS 2005, but not in Orcas, there are also some other issues in Orcas like switch or namespace blocks are not commented anymore. For this reason I started writing a new addin (without using CodeRush this time) last month, but I never found time to finish it.

Instead I wrote a new addin this weekend. It just fixes the region issue and adds support for IronPython, which does not have any regions at all. Now regions for all classes, defs (methods) and if blocks are generated for you and can be expanded and collapsed with the same hotkeys (Ctrl+4, Ctrl+5 or the VS defaults). Please note that I had commenter support for IronPython too and added stuff like #region and #endregion to it too, but it does not feel like Python anymore if you add too much comments and blocks. The beauty of Python is its short and self-explaining code and the more I work with it the more I like it.

RegionAddin Hotkeys:
  • Ctrl+1, Ctrl+2: Comment code like CR_Commenter (not implemented yet, it is commented out, too much features from CR_Commenter missing).
  • Ctrl+3: Build region like CodeRush or CR_Commenter, also commented out, CodeRush's version currently does work much better, but adds comments to #endregion
  • Ctrl+4: Collapse or expand the current region you are in
  • Ctrl+5: Collapse or expand all regions in the current file. In IronPython it has 3 modes: All uncollapsed, All methods collapsed, All classes and methods collapsed
  • Ctrl+6: Regenerate all collapsable blocks in IronPython, this is important because the IronPython language service does not support any collapseable blocks, maybe I will implement that later in there ...

Lets take a look at the region feature of RegionAddin for IronPython, Ctrl+6 generate all regions at once, otherwise regions are created automatically as you write code.




As always here is the full SourceCode and a Installer:
This is version 1, I will improve the addin in the future and provide better versions with more features in the future. Maybe I will also finish the CommenterAddin completely and add more support for IronPython (have to think about how it makes sense). Hopefully the RegionAddin is useful for C# and IronPython right now, it also supports all other C style languages like C++.

Monday, July 09, 2007 1:33:12 PM UTC (  |  |  |  |  )
Yeah! I have been awarded as a MVP (Most Valueable Professional) by Microsoft in the Windows - DirectX Category again.
Last year I got this award and each year it is renewed (or not) if you are still great enough ^^

I guess mainly my XNA projects and the Professional XNA Game Programming book are the reason to become MVP again.
But lately I have not done much DirectX or XNA programming, but questions from my colleagues and by email keep me fit in that area.

A nice warm thank you to all people happy with my work and publications and thanks so much to Microsoft for awarding me again.











 Thursday, June 21, 2007
Thursday, June 21, 2007 6:59:03 PM UTC (  |  |  |  )

I had often the problem that after a while of using Visual Studio 2005 (especially in beta) and now with Visual Studio Orcas that when the solution grows and grows to many projects you encounter the following error quite often:

Unable to copy file "obj\Debug\<projectname>.dll" to "bin\Debug\<projectname>.dll".

The process cannot access the file 'bin\Debug\<projectname>.dll' because it is being used by another process.

This can be caused if you have not closed the app yet or use the dll/exe somewhere or even if a unit test is still running and does not quit. But these cases are not the problem, that is easily fixed by killing the process. More often this is caused by some bug in Visual Studio. Some designer locked the file, some resource was not released, etc.
The usual "solution" to this problem was to close Visual Studio and start it up again, then it worked for a while until you end up with the same issue. Just having 2-3 projects in a solution is not very problematic because this error just occurs once in a while. With 5+ projects and using a lot of unit testing, starting tests all over the place, and compiling every couple of minutes (or seconds) this is really an annoying problem that can slow you down.

The easy fix is to delete the <projectname>.dll.locked file in the bin\Debug\ directory, after that compiling works again and it can copy the file now.
A better and more clever solution is to add the following lines to each Pre-Build-Events texbox in each project:

if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"

After doing that no more "Unable to copy file" errors anymore :)

BTW: My last attempt to polynap recently (1.5 hours sleep every 6 hours) failed after doing it for about a week, have to find a better schedule, maybe every 4 hours was a better idea because it was more strict.

 Sunday, June 17, 2007
Sunday, June 17, 2007 11:30:48 AM UTC (  |  |  |  |  )
If you do not know about FX Composer 2 yet and have not seen it before, check it out if you do any shader development at all. I was a big fan of FX Composer 1 and previewed FX Composer 2 kinda early and used it a bit in the Arena Wars Reloaded OpenGL Shader development.

The best features are full Collada support and full DirectX, OpenGL, FX (hlsl), CG and CGFx support and the nice UI and cool new features and toolboxes. The beta 3 version was released yesterday (first public version) and the final version will probably be available soon.

http://developer.nvidia.com/object/fx_composer_home.html#downloads



Mental Mill is also a part of the FX Composer 2 beta 3 installation. It is a really cool tool for artists, who do not want to hand-code shaders themselfes. Instead you can drag and drop components onto the workspace and connect them visually to create a shader. Really cool stuff, one of my artists is really a big fan of shader creation this way. I haven't used it much myself yet, I always end up finetuning the shaders myself.

Mental Mill:

 Saturday, June 16, 2007
Saturday, June 16, 2007 3:05:19 PM UTC (  |  |  )
I recently had the problem that a directory called "Cache" was always adding new files automatically
and adding them like crazy to our source control system. It was really annoying because we do not
need those cache files in source control and every developer had his own cache files, which always
had to be replaced. The simple solution is to make the folder hidden, this way it does not show up
in visual studio (except you show hidden files) and this way it does not get added to the source
control system.

Works with SourceSafe, Vault, Perforce and SubVersion.

 Friday, June 08, 2007
Friday, June 08, 2007 10:46:55 AM UTC (  |  |  |  )


Couple of tips if you want to debug Silverlight applications in Visual Studio. Please note I have not worked myself with Silverlight much, I was just observing my colleagues and helping them out when they were unable to debug their Silverlight code.

  • First of all: Visual Studio 2005 is NOT supported, you need Visual Studio Orcas Beta 1 (see my last 2 posts about it)

  • You need the VS_SilverlightTools_Alpha_Setup.exe setup file to get started with silverlight and allow debugging

  • The XAML designer view never seems to work and it usually does not even show up. If you want to hide it, switch the design and xaml views and then click the button on the very right to hide the design view on the bottom.

  • Most importantly: If debugging does not work for you make sure that:

    • Close ALL your instances of Firefox and Internet Explorer first. Then start the debugger of VS Orcas with F5 and let it create a new instance of your browser. This is VERY important because if you leave the browser open and start to set some breakpoints and debug the application, it won't work. Every time you press F5 in VS Orcas to start the project a new browser instance must be created, else debugging is just skipped and you just see the website, the debugger ends immediately. I tested it with Internet Explorer first, but Firefox is ok too if you can live with the constant opening and closing. For me it is much more comfortable to use Firefox for browsing and then Internet Explorer for testing the Silverlight stuff.

    • Your project/website/etc. does not contain any spaces. Like the .NET 3.5 installation there are still issues with spaces. Just make sure there are none. This wasn't a problem at my PC, but on a Vista machine it caused problems.

    • Exceptions seem to be ignored and there seems to be some Exception-Eating-Monster in the Silverlight runtime because no matter what happens or what you throw, it will not be passed to the debugger. Instead it just seems to end the debugging session and shows the page as far as it got. It is probably best to catch all exceptions yourself and display them in some label or flush them to a log file ..

 Thursday, June 07, 2007
Thursday, June 07, 2007 8:36:53 AM UTC (  |  |  )

After installing Visual Studio Orcas Beta 1 on Windows Vista you might run into the following problem after just creating a ASP.NET webpage (or a ASP.NET Futures or ASP.NET Ajax webpage, doesn't matter). This happend on a fresh Vista installation with just Visual Studio Orcas installed:



Visual Studio Orcas Beta 1 is not able to recognize the compiler settings in the web.config file, but the exact same file runs fine in Windows XP.



There are a couple of guys in the MSDN Forums having the same problem, but not solution there yet:
After reading those you might think that the .NET 3.5 Framework installation might be messed up, but everything else just works fine on Vista and you can create all kinds of projects including silverlight, wpf, forms, etc. with .NET 2.0, 3.0 and 3.5. We tried to uninstall Orcas and .NET 3.5 several times, reinstalling it, etc., but that did not help with the problem.

The relatively easy solution to all this is not to install XP (which probably some people did and I still use XP on my main development PC because of too many issues with drivers, games and applications), but to create a simple ASP.NET (or ASP.NET Ajax or ASP.NET Futures) in Visual Studio 2005 (which you have to install first, if you just have VS Orcas yet) and then to just load it with Visual Studio Orcas!

1. Start VS 2005 and Create a new website project:



2. Open as existing website in VS Orcas Beta 1:



3. You can compile and run the project now (and even add silverlight links and do whatever you want, it will run just fine), but you might get a warning that "System.Web.Extensions, Version=1.0.61025.0" was not found and that the website will use the "2.0.0.0" version instead.
Ignore the warning or just replace all "1.0.61025.0" with "2.0.0.0" texts in the web.config to get rid of it.

Hope this helps :)
 Wednesday, June 06, 2007
Wednesday, June 06, 2007 7:33:41 AM UTC (  |  |  |  |  )


Now this is really good news because I have been working with Orcas for over 2 months now and most of the features of CodeRush did not work in Visual Studio Orcas (even with my hack I posted a few months back). The new version of CodeRush, 2.2.2, finally supports parsing C# 3.0 and has MANY bugfixes and also quite a lot of new features. It was released last month, but I was quite busy and did not notice the update until now (they should implement a rss feed for updates ^^). Refactor! works also great and I might use it more often now (used mostly the refactor features of VS or some other tools in the past). Many thanks fly out to DevExpress, if you look below not many addins have support for Visual Studio Orcas, and CodeRush is best Visual Studio Addin ever, just for this reason alone :)

Because I'm currently developing a addins and even a VS package too (because I develop in IronPython right now, will post on that in a few days), I checked out some other addins. Here is my quick overview:
  • CoolCommands 3.0 adds some nice features to VS, mainly to improve interaction between VS, projects and the explorer or command line

  • MZ-Tools is a great addin for Visual Studio I never have heard of before (and I know a lot of addins).  It has a long feature list, check it out yourself ^^ Sadly it does not support VS Orcas yet, but it works nicely in VS2005 and does not override any behaviour of other addins like CodeRush as far as I can tell.

  • CodeIt.Right and CodeIt.Once I have heard of them before, but I never really installed it and check it out. It provides many useful reformating, refactoring and produtivity features, which allow you to quickly add existing code, reformat it automatically and apply rules for all developers on a project. They have also 3 short videos on their website so you can quickly see what this is about. Again no VS Orcas support yet as it seems.

  • SmartOutline is also an addin from the CodeIt.Right guys, they won the 3rd place in the VS Studio Extensibility Contest. All this addin does is add regions, but it is free to download and use. Not sure why this is great, my Commenter plugin could do that 3 years ago and does it in a much faster way (shortcut: Ctrl+3). CodeRush does support it too (Ctrl+R or Ctrl+3 too).

  • TestMatrix for Visual Studio .NET is a unit testing, code coverage and profiling addin. I'm not sure where the profiling comes in (I got Ants Profiler for that, havn't found a better tool yet. But I would like a better tool because Ants Profiler hasn't changed much in 2 years, which suxx), but the code coverage and unit testing features are nice. Probably not worth buying if you use TestDriven.Net like me. Code coverage can also be covered via NCover (a lot of covering in this sentence ^^).

  • Spell Checker is a really useful addin. Like using Word, when the spell checker is there, everything feels right, but when it is missing, it gets very annoying when you need it. I used the SpellChecker for CodeRush from RindHand, but Spell Checker is also very good.

  • Koders Addin for Visual Studio 2005 is also cool, but like most of the plugins, it only works in VS2005, no Orcas support yet. I have installed it for a long time, but I never use it. Dunno why, the idea is great, it allows access to many billion lines of source code and prevents you from re-inventing the wheel.

  • CodeKeep is very similar to Koders, but it focuses on code snippets. I have not used this addin before, but I will try it out, maybe I will use it more often than Koders.

  • I might also have installed 50 million other addins, but I have no time to talk about all of them, most of them are not worth mentioning ^^ In the past I have also talked quite a bit about addins and tools for Visual Studio, including TestDriven.Net, LineCounter, CodeRush, VisualAssist (for C++), CodeSmith and more. They are still great addins, no reason to mention them again, you know them probably already ^^
Take care.

 Tuesday, May 22, 2007
Tuesday, May 22, 2007 3:35:37 PM UTC ( )
Not really - Just wanted to update a LinqToSql file after I changed the database a little bit. I could not find any update button and "Execute Custom Tool" just did nothing and the source code did not change either. Not sure if this is a bug or just something that is not available. LinqToSql is still much better than the SQLMetal command line tool from LinqMay2006, but it is still annoying that it does not autoupdate itself.

I just tried to drag the changed database into the designer and this is what happend: No this test database is not that complex, it just has 5 tables and a few links and helpers between them.



If you just want to impress someone drag your tables a few times into the LinqToSql designer and you look like the smartest man in the world ... this is how it looks after you drag in the tables 2 more times:



Btw: I just want to have the freaking tables update themself, I obviously do not want 4 times the same tables. But I thought this looks funny ...
Tuesday, May 22, 2007 3:13:14 AM UTC ( )
Recently I talked a little bit about FreeMind (ok, maybe not as much as I wanted, but at least I mentioned it a few times). While I use it for sampler concepts and overview ideas instead of painting everything on paper and erasing it like 20 times until is is completely unreadable, I find it still to hard to add new nodes (hotkey: Insert) or to edit them (hotkey: F2).

For example my TODO list usually contains 5-20 entries per day and I have it open in Visual Studio side by side with my code and try to complete the tasks I give myself in addition to more general tasks from OnTime and fixing bugs if I have to (do not really like that part, code should just work, but sometimes there is not enough time to ensure that with unit tests). Anyway, having this TODO list outside Visual Studio is not a good idea for me, I tried many different TODO list programs, from websites to sidebars like Google Desktop or Vista Widgets, standalone programs like TODOList, etc. After a short while I went back to my messy TODO lists, for Arena Wars in 2004 I had a big TODO list with about 100k lines because I threw everything in there I was every thinking of for a few years. In later projects I just created a TOOD list for each project and it got less messy, but it was still hard to go through it after a while. I also had to refactor the lists a few times when things changed, which was especially painful if it was already too big to manage easily.



I tried using FreeMind or similar tools in the past, but importing the .txt files did not work out (mostly because older TODO list had not much of a tree structure) and getting it back to a useful .txt file was not possible. I also used my TODO list for dumping ideas, which was not a good idea because it got much harder to find actual work items between all the crazy ideas.

Now I use a strict ruleset for my TODO lists and they are like XML tree based and I only allow one entry per line (thats what word wrapping is for if lines get big). Now my TODO lists also are structured a lot more like a schedule for the project I'm working on. I still add TODO lists entrys at the bottom, but they get moved around if they can't be done in a day or week. It is important to notice that I never plan more than 1 week in advance for specific tasks. Each Monday I take the week plan, which is an overall idea what should be done this week and split it up into days and work tasks. It is also very agile and I change the overall direction a lot, which is exactly what my company requires ^^

Let's take a quick look at a simple example (by the way, very realistic for the kind of TODO lists I create every day):

TODO: Project "Taking over the world"
  TODO: Week 1 2007-05-21: Build world formula
    OK: Monday: Hire mad scientists
      OK: Install tools and instruct everyone.
      OK: Setup team in bunker for all the operations!
    TODO: Tuesday: Kill some people, just make sure everyone takes you seriously from the beginning!
    TODO: Wednesday: Still not serious? Hire Jack Bauer or someone similar
      TODO: You also need programmers, without them your project is lost.
      TODO: Buy some more mad tools, outsourcing is good thing, even for evil people
    TODO: Thursday: Get everyone together, make a big evil plan.
      TODO: Make sure everyone is on board.
      TODO: Kill everyone else!
    TODO: Friday: The weekend is probably not the best time to take the world over, wait for next week
      TODO: While you are at it, try developing the world formula, which was the task for this week!
      TODO: Beat some people up, make sure you are still taken seriously!
TODO: week 2: 2007-05-28: Time to take over the world
TODO: week 3: 2007-06-04: Make sure no enemies survive
TODO: week 4: 2007-06-11: Wait for everyone to accept you as their leader
TODO: week 134: 2009-12-20: Keep on waiting ...


Now we can take that bunch of genius material and just copy+paste it into an empty FreeMind project (make sure it is FreeMind 0.8, in 0.9 beta copy+paste does not work the same way yet), which will result in the following picture (I just dragged over all nodes to the right side, I like that much better. I also scaled it down, click on it for the full version):



Well, its cool and easy to use and best of all: I still can use my lovely good old TODO lists as .txt files, exporting back after resorting and rearranging the items in FreeMind is also easy, just press Ctrl+A to select everything (or just select a parent node) and copy it into your clipboard, then in NotePad, UltraEdit or Visual Studio paste it in again. Sometimes it also copies some other strange FreeMind data, but that can easily be removed and your TODO list is up to date. I also print out the TODO list each week for my colleages to let them see what I'm working on and what evil things I have planed for them :)
 Sunday, May 20, 2007
Sunday, May 20, 2007 3:38:12 AM UTC (  |  |  |  |  |  )
Dunno what happened. I wanted to post this a week ago but for some reason I did not find any time to post the whole week. This way I can probably give a more detailed view at the new programs I've been using for one to two weeks now.

BTW: I also updated some links in the menu and on the right side of this website, there were a lot of links not pointing to the correct locations.

First of all, I'm exclusively using Visual Studio Orcas now. I mentioned the Visual Studio Orcas Beta1 a month ago and explained how to import unsupported addins and fix some issues. I did not have much time to check out Silverlight yet, but it still looks very promising. There is also a new website from Microsoft called PopFly that is using it.

Last week one of my colleages was away for a couple of days and I stole his 24" monitor and put it right beside my 24". At that time I was converting a few projects from VS 2005 to VS Orcas, but as you can see that is way too much one the screen. I even tried to rotate both screens by 90 degrees, but after a hour I was feeling silly always looking up and down. Anyway, it is just too much to look at both these screens at once. Having one big 24" and a 20" or 19" right beside it is already a very effective solution. Important stuff goes on the big screen (VS mainly) and all the rest (firefox, ultraedit, explorer, whatever) go on the secondary screen.



This is my normal setup and I'm much more used to that. I have worked with multiple monitors for about 7 years now, it is nothing special anymore, but now is the first time I don't really need a bigger monitor anymore ^^




Ok, let's go on with some tools. I downloaded FreeMind a month ago and played around with it a little, but it couldn't convince me to replace my good old txt TODO list. But for other stuff FreeMind is really great.



In a matter of seconds you can create a overview design and it has the advantage to put it directly into a project instead of having it on paper, never been able to add stuff and losing it after a short while. Here is one of the FreeMind maps I have recently created just describing a project design and the workflow process. I have also seen examples of complete project management with FreeMind or using it for TODO lists or scheduling, but I'm not convinced that you are faster with it. I do not really need a graphical view of my TODO list, at least not at the time I throw ideas and tasks in there. To view the work process I could still convert my TODO list (which is tree based) to FreeMind anyway. It is just faster entering text into a text file than to anything else (which is also the main reason I never found any good TODO list tool).




Then on the recent DotNetRocks radio show I heard Eric Sink from SourceGear talking about Source Control and his tool SourceGear Vault, which is very similar to SourceSafe. This year I went crazy and tried all kinds of source controlling systems, including the following:


  • SubVersion (successor of CVS): SubVersion is a really great version control system and it works really good, both on small and big projects. We have used it for Arena Wars Reloaded and the only cavecat was getting it to work inside Visual Studio 2005. Thanks to the plugin VisualSVN it worked out just fine, only adding files is a real hassle (they are not added to the remote server, just locally). For VS Orcas there is no support and when you are working with ASP.NET websites in VS SubVersion and VisualSVN is a really bad choice IMO because it messes up the directories and does not add the files properly.



  • Perforce: Ok, I went back to Perforce, which I had used before, but mostly alone or together with another programmer. Perforce is a very professional solution, but again not very practical for anything but programmers and I wanted to include the graphic artists and project managers into the version control system too. Also Perforce still has a lot of issues with Visual Studio IMO and is still hard to setup, even with the much improved UI that finally allows you to set rights properly without messing in command line scripts. Again, no support for VS Orcas and the main reason not to use Perforce is the crazy price, $800 per developer, good bye! It was a lot cheaper a few years ago, but I never got into Perforce (mostly used SourceSafe in the past).



  • SourceSafe: Ok, back to the basics. The good old SourceSafe with an internal file system that no one understands, strange bugs that prevent you from adding files or the good old "If you delete a file, it is still there, just the content is gone"-"feature". For smaller projects SourceSafe is fine and if you do not have many developers, it works ok, but you can't give it to any graphic artist and once something gets messed up you need to spend a lot of time cleaning it up. The good thing is it works right out of the box in Visual Studio Orcas.



  • And then I tried SourceGear Vault: It is pretty much the same thing as SourceSafe, it just uses a SQL DB backend, has a much cleaner interface and much better tools including nice importers to get all your projects converted into the new version control system (yeah, everyone says they have importer, but they never work, the Vault Importer worked, it had no problem importing several GB of SourceSafe data). The disadvantage might be that it still feels like SourceSafe and it still has some of its issues (like deleting files and they appear again as 0-byte files), but overall it is much improved. We have just used it for a few days now and we had one merge problem so far, but that was probably because one artist did not check in his files and we changed it a few times. Vault also runs fine on VS Orcas as it probably just uses the standard SourceSafe interface for most of its stuff, which runs just fine on VS 2005 and Orcas.



  • I also tried a couple of other version control systems, but none of them worked in VS Orcas and I did not find a great one anyway. Some tools like AlienBrain have really nice features, but too much other stuff is missing and while it might be a great tool for artists, it is unusable for programmers. I do not believe in having separate version control systems, especially if you work tightly with your artists and make 10+ check ins per day with them.


I also use another tool called OnTime (Ship Software OnTime) for a while now. It is a project management tool and we use it mainly for bug tracking. It is about 700 times better than having you bug tracker on a stupid website. Website bug trackers like Mantis or BugZilla are not good for quickly adding tasks, entering bugs and fixing them in my opinion. They might be useful if you have to work with remote teams or if you expect really detailed bug reports. In our case we have mostly short tasks and quick bug reports, which are written in a few seconds.
But more importantly OnTime integrates directly into Visual Studio (sadly not VS Orcas, but the Windows tool on a secondary screen is fine too). It allows you to quickly add tasks for yourself or for any team mate and to go though 20 bugs in a few minutes (you will never be that fast with a website system). But the best feature IMO is the email management, OnTime allows you to send emails to a specific email address, which get picked up and added to the bug list. Then the programmer sees the issue, fixes it and the email sender gets a reply that the bug has been fixed. This system worked out great in our company.


For some strange reason I can't make screenshots with PrintScreen in Windows anymore. I guess some VNC tool messes up my clipboard or Windows just does not want to handle screenshots as big as my monitor resolution is. I searched for a good screenshot capture tool because I was getting annoyed with the PrintScreen+Paste in Paint or similar+Save somewhere on disk approach anyway. I used a tool a few years back that automatically made screenshot of the desktop every minute or so, which was funny, but I can't remember the name anymore. After testing a couple of crappy freeware and shareware programs I finally found Screenshot Captor, which is freeware and a really good tool with a lot of cool features. Most importantly, it allows you to capture your screen, window, or all screens with PrintScreen, Alt+PrintScreen or Ctrl+PrintScreen and it even safes the screenshot in the format you want into a directory you want. This was exactly what I needed :)

And finally to finish this big monster post: Blizzard announced today that StarCraft II is in the making and I was totally blown away by this. Many sites like GosuGamers.Net reported all week and were guessing StarCraft II or Diablo III, but there were so many rumors about StarCraft II, not many people were very sure of it anymore.



There are already some screenshots and game infos available, you can also find a few game play videos on youtube and 2 trailers by blizzard are on the official StarCraft II website, which is painfully slow by the way ^^ The game looks pretty good, but it still has many similarities with WarCraft III and there was already a lot of critics by pro-gamers and people in the StarCraft communities fearing that this game would be slower and less balanced than the original. I suspect the same, but StarCraft II will still be the best RTS that comes out in the next couple of years and every RTS fan will buy it anyway.

If it can surpass StarCraft - BroodWar is not for sure yet and we have to wait and see. It will probably attract more people to the StarCraft universe, but the old StarCraft community will not die that fast. It probably will take another 1-2 years until the game is done anyway. But this was very amazing news for me, I was suspecting Diablo III or some MMORPG from Blizzard, but not a PC-only old-school singleplayer+multiplayer game, that really goes back to the roots and just adds 3D graphics and physics to it. Nice job Blizzard!

 Wednesday, May 09, 2007
Wednesday, May 09, 2007 3:45:04 AM UTC (  |  |  |  |  |  |  )



Today I got the Wired Magazine in my mail and on site 80 there is a nice article about the development process of the XNA Challenge game Dungeon Quest from the GDC 2007. It was written by Mary Jane Irwin from the Wired Games Blog, thanks :). There is also a nice picture gallery with 21 images from the 4 days, which nicely shows the advancements we made each day. Enjoy!

PS: There is probably more information on this and other XNA projects on the huge Wired.com website, but every time I search for XNA or my name, I just find too many articles. Test for yourself.

Wednesday, May 09, 2007 12:27:16 AM UTC (  |  |  )
StudiHelp.de is a german student community site with many features. Because it is currently target at a german audience the rest of this post will be in german ^^



Einfach auf das Bild klicken um sich das ganze mal anzugucken. Die StudiHelp.de version liegt nun auch nicht mehr auf unserem Entwicklungsserver und ist inzwischen auch schon stabiler geworden. Aber wir haben noch keine Langzeittests gemacht und es gibt noch paar Kleinigkeiten, die wir diese und naechste Woche fixen wollen.

Aber kein Grund Interessierte nicht schon jetz draufzujagen. Hier ein paar der neusten Features (PS: Ich hab natuerlich keine deutsche Tastatur, also nicht wundern, wenn hier ue's, ae's, oe's, etc. fehlen ^^):
  • Wir haben ja schon an die 1000 Studiums-Dokumente und nun kann man von jedem auch eine Flash-Vorschau direkt auf der Seite angucken und ein bisschen drin stoebern. Momentan sind wir sehr stolz auf dieses Feature. Das ganze funktioniert natuerlich auch fuer alle neue Unterlagen, die ihr hochlaed.
  • Tag basierte Interessen mit einer huebschen Uebersichtsseite, die immer gleich andere User zeigt, welche auf aehnliche Dinge abfahren.
  • Verwalte deine Freunde in "Meine Freunde". Hier kommen auch noch ganz abgefahrene Features in Kuerze.
  • Im Studiumsbereich kann man sich Faecher anlegen oder existierenden Faechern beitreten und somit Kommilitonen leicht wiederfinden und mit ihnen diskutieren und Unterlagen tauschen.
  • Unter Bilder kann sich jeder eigene Alben anlegen und Bilderbuecher erstellen. Hier haben wir ausserdem noch paar coole innovate Features fuer die nahe Zukunft geplant (Note: Momentan wird das Albumsmodul noch ueberarbeitet, also entschuldigt kleine Fehler und Unannehmlichkeiten).
  • Man kann natuerlich auch das uebliche machen, wie Freunde adden, im Forum rumposten, Gruppen erstellen, Profileinstellungen machen und Gaestebuecher vollspammen, etc.
Stay tuned, more to come!
 Tuesday, May 08, 2007
Tuesday, May 08, 2007 3:55:20 AM UTC (  |  |  |  |  |  |  |  |  )

I heard about all the Silverlight fuss from the MIX2007 conference last week, but I did not have time to check it out with all the stress and projects I'm currently involved in. I already use VS Orcas for a while (see post from last month) and I played around with WPF in the past (formerly Avalon, now Silverlight, which is still in beta, but will be released this summer finally), but I did not find anything compelling for a game programmer since we use DirectX or XNA anyway. But with the ability to build websites with Silverlight and still allowing the .NET framework to exist in that environment while simplifying the development process and getting away from building static html like pages with some dynamic features (ajax or not, it is still somewhat static and hard to do), Silverlight gets much sexier than just WPF on a windows app by itself.

Why is Silverlight cool? It is .NET, it runs on Firefox, IE, Safari, Mac, etc. it is just 2 MB download, it is amazingly fast, it has many cool new features, it allows many windows-only apps to be developed for the browser in a more natural way, it will be pushed like crazy and a lot of people will have it till the end of this year, there are already some cool tools out there including the Expression toolkit and Visual Studio Orcas, and probably a lot of other reasons you can checkout yourself!

Maybe it is even possible to interop with some DirectX or XNA stuff somehow. I have no idea if this is possible at all or if there are security issues or this kind of functionality is not possible at all, but instead of waiting for another week until I find a few minutes to test this out, why not announce it here first that this would be cool and maybe someone else can test it for me :)

Even for just doing websites, Silverlight will definitely become a BIG competitor to Flash based websites, developing in .NET will be a lot easier than working with Flash/Actionscript/whatever and I would bet that there are more VB/C# developers that can now do some great websites without having to learn much while creating Flash sites or even doing ASP.NET (with or without Ajax) development is much harder and less compelling for certain kinds of applications. Great examples are the FOX Movies site and some widgets on MSDN or some early test controls from Telerik.

BTW: Archor wrote me an email about his Cyber Car XNA game he wanted to submit to the XnaProjects.Net site I made last week. This is actually a Racing Game Mod, I first guessed he used the simple racing game version, but this one is based on the full racing game from the XNA creators website. Pretty cool style in my opinion. Thanks Archor!

http://xbox360.archor.com/

 Friday, May 04, 2007
Friday, May 04, 2007 1:29:43 PM UTC (  |  |  |  |  |  |  |  |  )
Yes. My XNA book is finally out and some people even got an early version last week. There is also some discussion going on in the XNA Forums and on the official Wrox forum for the book.

The coolest thing yesterday that my book was on Rank #16 for Computer/Technical books on Amazon.com and on Rank 500 something for all books. Quite impressive if you ask me, hopefully it will continue to stay high and make me filthy rich .. just kidding.

Yesterday I wanted to put all the samples from the book on my blog, but it is already way to overloaded here with screenshots and games, adding another 10 games will not make anything better. Instead I had a crazy idea to create a XNA Community site in one day. It is called XnaProjects.Net. The idea is for everyone to submit their games and links. News are grabbed with Google Blog Search and more features will come in July 2007 when I got more than 5 minutes time in a row.

Anyway, check out this great new website, submit your games and links and check out whats already submitted by me (10 Games so far, yes, thats a lot of XNA games I did in the past few months):

  • XNA Pong
  • XNA Breakout
  • XNA Tetris
  • Rocket Commander XNA
  • XNA Shooter
  • XNA Racing Game
  • SimpleRacingGame
  • SpeedyRacer
  • Dungeon Quest
  • Skinning with Collada Models in XNA
You can find source code and game installers for all of these games, including some nice screenshots and a YouTube video for each of them on the XnaProjects.Net website. Check it out:
 Friday, April 27, 2007
Friday, April 27, 2007 7:24:34 PM UTC (  |  |  |  |  |  )

I have put together a little website for the XNA Racing Game Starter Kit released yesterday on
http://creators.xna.com/Education/StarterKits.aspx

Here you go: http://www.XnaRacingGame.com




A little rant about the XNA Racing Game Starter Kit download: The download file is 130 MB in size and will eat up almost 290 MB of your hard disk space extracted. It is also only available in the .vsi format and can't be used in anything but XNA Game Studio Express or Visual C# Express. The main reason for this incredible size is the Textures directory, with uses mainly uncompressed .TGA files. The original Racing Game version had only about 50-70 MB in total with DDS textures and the Simple Racing Game version from my book is even smaller (30 MB I think, but a lot of content is not in there, its a also a much smaller and simplified project).

Microsoft has also removed all credits of me, all readmes, all unit tests, most comments, some screens like the credit screens. It's a little bit sad for me because all references to me or my website were removed and I'm not even mentioned on the starter kit download page :( I think the starter kit is now much harder to understand because there are no unit tests in the code to test anything out. Anyway, I just hope the XNA Racing Game Starter Kit is useful for you guys, it helps XNA and everyone wins :-)

Update 2007-05-01: I'm now mentioned on http://creators.xna.com and happy :)
Friday, April 27, 2007 9:28:15 AM UTC (  |  |  |  |  |  )

Nice one. The Racing Game Starter kit for XNA Game Studio Express I made last year is now available on
http://creators.xna.com/Education/StarterKits.aspx

More information will be available shortly on the in-official website for the Racing Game (link to the xna creators club, screenshots, mod support and forums later):
http://www.XnaRacingGame.com

Enjoy the Racing Game ;-)

My book Professional XNA Game Programming for the Xbox 360 and Windows seems to be out too. I have not received a copy myself yet, but I received some emails about other guys already holding it in their hands ^^ If you try to download the source code for the book from the Wrox website and encounter problems, please be aware that the download link is currently pointing to an older version, which still has some issues. I will try to sort that out as soon as possible. The official release date was 11 May, 2007, but Amazon says it is already available, while their own release date is stated as 30 April, 2007. Confusing, isn't it?

If you find any issues with the starter kit or the book download please write me a message so I can fix it as soon as possible. Many thanks to ZMan (Andy Dunn) for an early bug report.

 Monday, April 23, 2007
Monday, April 23, 2007 12:58:53 PM UTC (  |  )
Here are some pics from the Quo Vadis Conference 2007 in Berlin (from last weekend).



This is what the Quo Vadis is about, everything and nothing.


Entering Berlin, bigger roads and bigger houses, other than that not much different than Hannover except for its huge size (in Germany we do not have any big cities except for Berlin).


The "Siegessaeule". Dunno whats that is in English, probably Victory Column, doesn't make much sense, does it?


The Brandenburger Tor .. maybe it would be better if I write this blog entry in German.


And the big TV tower in the middle of the city with a rotating restaurant in the middle.


Finally at the Quo Vadis Conference itself. A lot of people are already here, a lot of familar faces, but not many developers from our region for some strange reason, but all the big guys were there.


The game design lecture about Crysis. It was actually quite nice and the Nanosuit looks like a very polished feature. Hopefully the game design will not suck as much as in FarCry for the second half of the levels.


You really had to concentrate hard in order to get Wifi working. With that many people logging onto the same hotspot, it was not very likely that you get any download through in the middle of the day. In the morning and evening the Wifi Lan was pretty fast and useable.


One of the few technical lectures. This is Intel's Core 2 Duo lecture, which was quite technical with a lot of assembler code and internal tricks. It was very informative.


This is the room I was speaking in. It was a little workshop about XNA and I showed some games and showed how to work with XNA Studio Express.


A little bit of the Racing Game.


And here a bit of the Dungeon Quest game I did last month on the GDC in 4 days. Little dark on a projector in the middle of the day.


And some other games. There was also someone trying out XNA as I was speaking. There was not much interaction with the audience because most people had no questions, but I talked my way through it and I heard some positive feedback about XNA later.


Me in Terminator mode at night when we went to the Quo Vadis Party per train. Maybe my cell phone is as explosive as the one from Terminator 3 ^^


At the Party it was loud and hard to speak, but we met a lot of nice people and the usual suspects. Its always good to know what everyone else is doing because most developers you just meet on such events.


And that's it for this years Quo Vadis, 3 days of lectures and workshops, which turned out to be better than we thought. Especially on day 3 the project management workshops were really interesting.

 Wednesday, April 18, 2007
Wednesday, April 18, 2007 8:20:13 PM UTC (  |  )



The next 3 days I will be on the german Quo Vadis conference and I will speak a lot about XNA together with my good old Microsoft friend Dirk Primbs. You can find us every day from 14 to 18 o'clock at the "Seminar 10 - Ufo" Room where we will do the Workshop "Hands on XNA". More information can be found in the program on the official Quo Vadis site: http://www.die-entwicklerkonferenz.de

If you are there too and want to meet with me, drop me an email or use the meeting form on the website there. Or just come by. I will also show all the latest projects I have done so far with XNA and .NET, hopefully this attracks more people to XNA, which means more people can buy my book ;-)
 Friday, April 13, 2007
Friday, April 13, 2007 10:39:20 AM UTC (  |  |  )
My blog posts are getting shorter ^^

Usually you can't execute web service methods from the autogenerated web service site remotely to test them. By default you will get the following message where the web service test is supposed to be:
  • The test form is only available for requests from the local machine
Fix this by adding the following to your web.config file of your web service:

<configuration>
    <system.web>
        <webServices>
            <protocols>
                <add name="HttpGet"/>
                <add name="HttpPost"/>
            </protocols>
        </webServices>
    </system.web>
</configuration>


BTW: Any messages in the Test section of the web service site will be "The test form is only available for requests from the local machine" even if the problem is something else, which you will see when testing locally like "The test form is only available for methods with primitive types as parameters.". There seem to be no way around that.
Friday, April 13, 2007 8:42:28 AM UTC (  |  |  )
Just found this by accident: NUnitAsp. Seems to be very useful. I was always wondering why TestDriven.NET does not support testing web sites or services. It gives you the following message if you try to run tests from a website:
  • Can't execute tests in 'Web Site' application.
There are probably other reasons why this does not work yet, but maybe it is possible to find a way around that. Currently I use a extra project and call the web site or web service from there with my custom methods. It looks much cleaner with NUnitAsp. For me it would even be better if I could write and run unit tests directly on the website without that extra project. Maybe I should drop Jamie Cansdale of TestDriven.NET a short message asking him for some support in the future for ASP.NET. There does not seem to be anything on his blog about ASP.NET yet, at least the search returned 0 results.

Here is a little example from NUnitAsp, which shows you how to test a label on a website:

[Test]
public void TestExample()
{
  // First, instantiate "Tester" objects:
  LabelTester label = new LabelTester("textLabel", CurrentWebForm);
  LinkButtonTester link = new LinkButtonTester("linkButton", CurrentWebForm);

  // Second, visit the page being tested:
  Browser.GetPage("http://localhost/example/example.aspx");

  // Third, use tester objects to test the page:
  AssertEquals("Not clicked.", label.Text);
  link.Click();
  AssertEquals("Clicked once.", label.Text);
  link.Click();
  AssertEquals("Clicked twice.", label.Text);
}

 Wednesday, April 11, 2007
Wednesday, April 11, 2007 8:50:47 PM UTC (  |  |  )
After developing and testing some ascx web controls in the past I was woundering why I have to copy them over to a new web project today instead of just referencing them. When you write a normal windows application and then want to reuse some library parts in another project (or if you just want to structurize your app a little bit better) you would obviously use a dll library for the job to share functionality.

Not that easy with web controls. My first thought was just to copy the .ascx and .ascx.cs files over to a new dll project and start compiling. After adding the missing images and scripts the following thing happend:



Well, the code does compile on a website, but in a dll project it will not build the ascx code for you and merge the controls defined there with your .cs file. If you do not define controls or do any visual stuff you can probably just use WebControls instead of UserControls, but you still have to implement the Render method yourself and you just do not have any design support. More information about creating server controls can be found here.

While that solution is probably the cleanest one and has the advantage of hidding the source code and make it easy to just drag and drop controls on your page, it is the hardest to develop. And I already have my .ascx controls working, I just want them in another project without copying them over again and again.

I searched for a while on the web for some solutions, see below for all the links. The best solution for me was the one from ScottGu, which just uses a normal website and then uses a post build copy to get all the files into your current website project. The controls dummy website can then be used all over the place, you just have to add the copy command to each website that should use your controls. This solution might not be the best, so if you have more complex problems, check out the links below.

No reason to repeat all the stuff ScottGu has already written, check out his great article here or here.

BTW: I use this just for simpler web controls or when I have something that needs to be duplicated on some pages. For Ajax controls on the other hand I got a project similar to the AjaxControlToolkit, but there you live without design time editors anyway.

Links:
 Friday, April 06, 2007
Friday, April 06, 2007 11:25:01 PM UTC (  |  |  |  )

AnnoyingFilesRemover.zip (6.1 KB)

Recently I had to remove a lot of .svn and Thumbs.db files from certain directories because I wanted to move them or someone else had created thumb files (which is really annoying). After deleteing those files by hand a couple of times I decided it would be better to have some tool doing that for me. That should be easy to do, shouldn't it?

I started by opening VS Orcas and coding for a while, but for some reason the commenter plugin for CodeRush was not working anymore, which already annoyed me. Then the Intellisense crashed several times, but VS Orcas did not close, which was a nice feature. But without CodeRush it was a little bit annoying to generate all that code by hand and then to write all the comments also by hand. I removed the LINQ test code I used to go through all directories and added some foreach loops (just 2 lines more, how cares) and went back to VS 2005 for this project.

The next big problem was the removal of read-only files and directories, which is just not allowed in the .NET framework, you will get the following exception:

System.UnauthorizedAccessException occurred
  Message="Der Zugriff auf den Pfad entries wurde verweigert."
  Source="mscorlib"
  StackTrace:
       bei System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive)
       bei System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive)
       bei System.IO.Directory.Delete(String path, Boolean recursive)
       bei AnnoyingFilesRemover.RemoverForm.SafeDeleteDirectory(String directory) in C:\code\Communities\AnnoyingFilesRemover\RemoverForm.cs:Zeile 153.

The MSDN help for Directory.Delete gives you the explanation that this happens because you are trying to delete a read-only file.

   UnauthorizedAccessException: The caller does not have the required permission.

This is only half the story because if you look in File.Delete you see a more detailed error explanation:

    UnauthorizedAccessException: The caller does not have the required permission.

    -or- path is a directory.

    -or- path specified a read-only file.


And the directory I wanted to delete was ".svn", which is read-only and hidden. An easy way around that is to change the directory attributes. But that won't help if there are still files in the directory because you will still get the same error. Instead you have to replace all the file attribute for all sub directories and files too. I wrote the following method to do that.

#region RemoveAllAttributes
/// <summary>
/// Helper to remove all file and sub directory readonly attributes
/// to make SafeDeleteDirectory work!
/// </summary>
/// <param name="directory">Directory to change (will be deleted later
/// anyway)</param>
private static void RemoveAllAttributes(string directory)
{
    // Get all files and sub directories.
    string[] files = Directory.GetFiles(directory);
    string[] directories = Directory.GetDirectories(directory);

    // Kill all attributes, make files normal and directories just directories
    foreach (string file in files)
        File.SetAttributes(file, FileAttributes.Normal);
    foreach (string dir in directories)
        RemoveAllAttributes(dir);

    // Finally set the main directory to a normal directory!
    File.SetAttributes(directory, FileAttributes.Directory);
} // RemoveAllAttributes(directory)
#endregion


The rest of the tool is easy to understand and there is nothing special about this tool except that I find it very useful right now. It is also very fast, I let it run over 20 000 files and it was done immediately and had deleted several hundert files in the process. Again: Be careful what you type in the filters textbox and save important directories before messing with them.

As always, here is the download and source code (both in .NET 2.0 since I have removed all LINQ features that were not important for this project anyway):

Search

Projects I currently work on

MeinSport.de - German Sport Community Site

StudiHelp.de - German Student Community Site

Arena Wars Reloaded

New Arena Wars Website

My book: Professional XNA Game Programming (May 2007)

Dungeon Quest

Racing Game XNA Starter Kit

Speedy Racer Mod (from da book)

XNA Shooter

Some unannounced projects (games, websites, wikis, and my favorite: a new programming language)

See completed projects on the left side

Downloads: Games, Tools and Sourcecode

Rocket Commander, Mods and SourceCode

NormalMapCompressor v1.3

CR_Commenter

AbiKeyboardV9 layout and CountMostUsedKeys