1

Closed

BooBinPath should not be stored in the .booproj file

description

Two reasons:
1.) if different developers have different paths it will be a source control nightmare.
2.) it will prompt you to save the project even if you haven't changed anything. (the first time at least).

The trick is that the targets file still needs to be compatible with #dev and therefore we need to use the $(BooBinPath) to find the targets file. Ideally we would be able to set the BooBinPath variable into msbuild wihtout having it saved in the actual .booproj file. It needs to be added at buildtime only in memory.
Closed Aug 29, 2008 at 4:38 PM by
fixed by justinc

comments

olsonjeffery wrote Jul 11, 2008 at 5:11 PM

in the current implementation, all of the action is in the BooLangProjectFactory constructor in BooLangProjectFactory.cs in the BooLangProject project.

It looks like this:
    public BooLangProjectFactory(Package package)
        : base(package)
    {
        RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\BooLangStudio");

        // The path should be in the registry, but if it's not then do your best by looking
        // at the location of the current assembly!
        string booBinPath = (string)(key != null ? 
            key.GetValue("BooBinPath") : 
            Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"..\Dependencies\boo\build\"));

        this.package = (ProjectPackage)package;
        this.BuildEngine.GlobalProperties["BoocToolPath"] = new BuildProperty("BoocToolPath", booBinPath);
        this.BuildEngine.GlobalProperties["BooBinPath"] = new BuildProperty("BooBinPath",booBinPath);
        this.BuildEngine.GlobalProperties["GenerateFullPaths"] = new BuildProperty("GenerateFullPaths", "True");
    }
The reason I went with this implementation was for the reason that justin outlines, namely that a BooBinPath needs to be defined when the project is loaded... the problem is that, using the method outlined here, it seems that Visual Studio is inserting the value fetched from the registry into the project file..

also, there is this in BooProjectNode.cs:
    protected override void Reload()
    {
        base.Reload();
        // setting the BooBinPath
        string booBinPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
        this.SetProjectProperty("BooBinPath", booBinPath);
        this.Save(this.FileName, 0, 0);         
    }