Inside F#

Brian's thoughts on F# and .NET

Sneak peeks into the F# project system, part three

Posted by Brian on August 3, 2008

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.

About these ads

One Response to “Sneak peeks into the F# project system, part three”

  1. Gaurav said

    these smaller things r important ones…
    I m looking forward to next ctp release…
    excitin9…stuff..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 30 other followers

%d bloggers like this: