NuGet: What's the appropriate “FrameworkName” for creating packages with Windows Phone 7 binaries?

StackOverflow https://stackoverflow.com/questions/4766908

سؤال

I just created a NuGet package for one of my open source projects and it includes a Windows Phone 7 binary. I just tested it and instead of adding the Windows Phone 7-specific library, it added the Silverlight library.

My question is, how can I set up my folder architecture such that the NuGet package manager recognizes my WP7-specific binaries and installs those instead of the Silverlight binaries?

I followed the instructions listed here for targeting multiple frameworks in NuGet packages.

Here's what my folder tree currently looks like:

\lib
    \.NetFramework 4.0
        \MyAssembly.dll
    \Silverlight 4.0
        \MyAssembly.Silverlight.dll
    \Windows Phone 7
        \MyAssembly.Mobile.dll

What should I be doing differently?

هل كانت مفيدة؟

المحلول

We don't support wp7 natively yet since there is no profile support (the profile part of the framework name isn't supported in folders). See this issue for more details http://nuget.codeplex.com/workitem/219.

FWIW: Windows phone 7 is Silverlight 4, Profile=Windows Phone.

For now you'll have to create another package for wp7.

نصائح أخرى

It looks like this has been fixed with the latest version (1.1) of nuget. You can verify this with the following test (taken straight from the Nuget unit tests):

[TestMethod]
public void ParseFrameworkNameWithWPProfileGetNormalizedToWindowsPhone() {
    // Act
    var frameworkName = VersionUtility.ParseFrameworkName("sl4-wp");

    // Assert
    Assert.AreEqual("Silverlight", frameworkName.Identifier);
    Assert.AreEqual(new Version("4.0"), frameworkName.Version);
    Assert.AreEqual("WindowsPhone", frameworkName.Profile);
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top