coapp / coapp.powershell

ClrPlus Signing
52 stars 43 forks source link

"Linkage" setting is generated for packages that don't use them in weird circumstances #29

Open yodantauber opened 10 years ago

yodantauber commented 10 years ago

Steps to reproduce:

  1. Create a package from the attached autopkg script and put it in your package source.
  2. Create a new VC++ project.
  3. Install the PropertySheetBug package into the project.
  4. Go to the property pages of the project, look under "Referenced Packages" section.

Expected: there is exactly one setting - "Something", which is indeed used by the package. Actual: there is one more setting besides "Something", which is "Linkage". It is not used by the package and seems to come out of nowhere.

Weird note: repeat this experiment with the commented line entirely removed. Alternatively, change the description (within the commented line) from "statically dynamically" to something else. Either way, the "Linkage" setting will no longer be generated!

yodantauber commented 10 years ago
configurations {
    Something {
        choices : { X1, X2 };
        //description = "statically dynamically";
        description = "abc11943073q98475983rtkjgxdfkjlghk";
        X1.description = "zzz";
        X2.description = "yy";
    }
}

nuget {
    nuspec {
        id = PropertySheetBug;
        version : 1.1.2;
        title: Property Sheet Bug;
        tags: { native };

        projectUrl: "http://www.example.com";
        iconUrl: "http://www.example.com";
        licenseUrl: "http://www.example.com";
        releaseNotes: "";
        description: "Property Sheet Bug";
    };

    files {
        [X1] { 
            lib: 1.lib;
        }
        [X2] { 
            lib: 2.lib;
        }
    };
}
fearthecowboy commented 10 years ago

Oh, you've uncovered my dark little secret hack...

In order to provide some support for ensuring that the consumer is using the correct runtime library (since the four RTs in MSVC aren't link-time compatible ... $%($%^()%!! ) I check to see if the word 'static' or 'ltcg' is in the propertysheet, and if it is, I insert another sheet that looks like this:

// Implicity loaded template script for Autopackage

nuget := {
    targets {
        [Debug,static] {
            ExpectedRuntimeLibrary = MultiThreadedDebug;
        }

        [Release,static] {
            ExpectedRuntimeLibrary = MultiThreaded;
        }   
    }
}

which ... triggers the pivot used for static, fooling the part of the code that builds the XAML that handles the UI for the properties window.

I was hoping that I could get away with this until I could go back and figure a cleaner workaround.

I'm so very ashamed. :(

ggarcia24 commented 10 years ago

This is given me some problems when trying to link Boost statically but with a Dynamic runtime, is it possible to avoid this behavior?