Brian's profileInside F#BlogGuestbookNetwork Tools Help

Blog


    August 03

    Sneak peeks into the F# project system, part three

    There will be a number of new F# IDE features in the upcoming CTP release.  One that you may have used with other Visual Studio languages is "Add As Link".

    Add As Link

    By default, when you add an existing item that lives outside of the current project directory, Visual Studio will copy the file to the current project directory. 

    image

    If I select a file from some other directory (for instance, from a C# project directory)...

    image

    Then a copy of that file (here, App.config) gets added to the project:

    image

    You can tell it's a copy by looking on disk:

    image

    which shows the new file has been copied to the F# project directory:

    image

    However, if we start over, we could instead choose to add the file as a link (notice the drop-down in the bottom-right corner of the screenshot):

    image

    Then a linked file is added to the project:

    image

    Note the little arrow sub-glyph in the icon that shows that the file is a link.  It has not been copied to the project directory:

    image

    If you are familiar with msbuild, then you may recognize the representation in the .fsproj project file:

    image

    Whereas the "Include=" bit describes the physical location of the file, the optional "<Link>" tag is used by linked items to describe how to project linked files into the solution explorer view inside Visual Studio.  This is no different than how things work in C#.

     

    Also in the upcoming CTP release, we'll also support a better "ordering experience" from inside the solution explorer in the IDE.

    Move Up and Move Down

    If you want to change the ordering of files, you can do it via the right-click menu in the solution explorer.  Say I have

    image

    and I decide that Program.fs needs to be moved before File2.fs.  I can right click on Program.fs...

    image

    and select "Move Up", and...

    image

    now Program appears above File2.  There will be a key-binding (probably Alt-Up/Alt-Down) associated with the Move Up and Move Down commands.

    Add Above and Add Below

    If I am adding a new file to a project, and I want it to appear in the 'middle' somewhere, I could right-click on the project, do "Add New Item...", have the item get added to the bottom, and then use a series of Move Up commands to get the file into the right spot.  Or, I could use this new menu command:

    image

    so that the new file appears above or below an existing item.  Here I've added a new item File3.fs above Program.fs:

    image

    These new commands make it much easier to manage the file order in an F# project.

    Comments (1)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Gaurav Kalrawrote:
    these smaller things r important ones...
    I m looking forward to next ctp release...
    excitin9...stuff..
    Aug. 4

    Trackbacks

    Weblogs that reference this entry
    • None