BlockLeftTop, PRELOAD BlockLeftBottom, PRELOAD BlockLeftStretch, PRELOAD BlockTop, PRELOAD BlockBottom, PRELOAD BlockStretch, PRELOAD BlockRightTop, PRELOAD BlockRightBottom, PRELOAD BlockRightStretch, PRELOAD

Quick Tip: Getting rid of the "Unable to copy file" error in Visual Studio

by Benjamin Nitschke 21. June 2007 18:59

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.

FX Composer 2!

by Benjamin Nitschke 17. June 2007 11:30
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.

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:

Quick Tip: Exclude Files and Folders from Source Control

by Benjamin Nitschke 16. June 2007 15:05
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.

Debugging Silverlight in Visual Studio

by Benjamin Nitschke 8. June 2007 10:46

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 ..

Fixing the "Child nodes not allowed." bug in Visual Studio Orcas under Vista

by Benjamin Nitschke 7. June 2007 08:36

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 "" version instead.
Ignore the warning or just replace all "1.0.61025.0" with "" texts in the web.config to get rid of it.

Hope this helps :)

CodeRush has now VS Orcas support

by Benjamin Nitschke 6. June 2007 07:33

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.

Disclaimer: The opinions expressed in this blog are own personal opinions and do not represent the companies view.
© 2000-2011 exDream GmbH & MobileBits GmbH. All rights reserved. Legal/Impressum


Which platform should Soulcraft be released on next?

Show Results Poll Archive

Recent Games



Jobs @ exDream


<<  April 2014  >>