Tuesday, July 28, 2009

Using the free space in one drive to give more space on another

I run into an issue today when I wanted to have something on my C: drive that exceeds the current free space, I have more free space on other drives but I don’t want to go into extending my C: drive by using tools like Partition Magic as I had a bad experience with it before.

I decided to give hard links a try, and after some googling I found that I need to use the junction.exe from Sysinternals because Windows don’t

So, if you need to have a folder on C: drive that points to another folder on D: drive, you just need to call junction like this:

junction C:\MyFolder D:\MyFreeSpace

You will deal with C:\MyFolder as a normal folder, but actually all files will be stored in D:\MyFreeSpace

Sunday, July 05, 2009

Generate (a new) GUID each time you run an MSBuild Script

Sometimes we need to generate a new GUID and use it as part of a build script, for example when building a new version of a Setup project.

MSBuild built-in tasks don’t provide such facility, however there 2 options:

1.MSBuild Community Tasks (Script Task)

The Script task from MSBuild Community Task allows the execution of .net code contained within the task. It will be very simple to call System.Guid.NewGuid() and return the string into an MSBuild Property.

 

<PropertyGroup>
  <GuidGenFunction>
    <![CDATA[
      public static string ScriptMain() {
          return System.Guid.NewGuid().ToString().ToUpper();
      }
      ]]>
  </GuidGenFunction>
</PropertyGroup>

<Script Language="C#" Code="$(GuidGenFunction)">
      <Output TaskParameter="ReturnValue" PropertyName="NewGuid" /> 
</Script> 
<Message Text="Guid: $(NewGuid)" />

 

 

2.Sedodream MSBuild Project (CreateGuid Task)

http://sedodream.codeplex.com/Wiki/View.aspx?title=CreateGuid