Pages

Wednesday, August 22, 2012

F# Add Reference Addon

Recently we got a customer request to add reference to FSI. I get this feature working and another feature added. A "Scripts" folder is created which contains several .fsx files. See the screen shot below. These script files are generated to help to load the project references and project. Typically there are only Debug and Release configuration, if there is other configuration, a new set of files are generated. Auto update happens after each build. The content of these file are updated automatically. It can be download it from visual studio gallery.




c:\MyProjects\MyProject\Scripts\load-refs.fsx:

  #r "System.dll”
  #r "System.Xml.dll”
  #r @"c:\MyProjects\OtherProject\bin\Debug\OtherProject.dll”

c:\MyProjects\MyProject\Scripts\load-refs-release.fsx:

  #r "System.dll”
  #r "System.Xml.dll”
  #r @"c:\MyProjects\OtherProject\bin\Release\OtherProject.dll”

c:\MyProjects\MyProject\Scripts\load-proj.fsx:

  #load @"c:\MyProjects\MyProject\Scripts\load-refs.fsx”
  #r @"c:\MyProjects\MyProject\Debug\bin\MyProject.dll”

c:\MyProjects\MyProject\Scripts\load-proj-release.fsx:

  #load @"c:\MyProjects\MyProject\Scripts\load-refs-release.fsx”
  #r @"c:\MyProjects\MyProject\Release\bin\MyProject.dll”



4 comments:

Nicolas said...

Very cool. It is indeed a basic need when doing using classes from FSI.
I had adapted a similar script here : https://gist.github.com/3387537

which you have to run everytime references of the project are changed though. it guarantees that when your scripts compiles, they run

Nicolas said...

Very cool. It is indeed a basic need when doing using classes from FSI.
I had adapted a similar script here : https://gist.github.com/3387537

which you have to run everytime references of the project are changed though. it guarantees that when your scripts compiles, they run

Dave Thomas said...
This comment has been removed by the author.
Dave Thomas said...

That might take a bit of the pain away from references in fsi, I tend not to use it as much as other REPL because of that and some other reasons.