locked
Portable Library and WindowsAzure Storage RRS feed

  • Question

  • Hello,

    I am trying to use Microsoft.WindowsAzure.Storage from a portable library.

    I am currently targeting:

    • .NET Framework 4.5
    • Silverlight 5
    • Windows 8
    • Windows Phone Silverlight 8

    I have tried several variations though.

    What I did

    1. Run the following command Install-Package WindowsAzure.Storage-Preview -Pre
    2. It says that it added it successfully: <package id="WindowsAzure.Storage-Preview" version="3.2.0-preview" targetFramework="portable-net45+sl50+win+wp80" />
    3. However, no reference ever appears in my References list, and I cannot access the blob storage stuff (can't resolve it etc)
    4. I finally just browsed to the package and added the lib and it does show up
    5. However, I am spammed by the following warning

    Warning 4 Reference to type 'System.IO.FileMode' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile\Profile158\mscorlib.dll', but it could not be found Source\Applications\packages\WindowsAzure.Storage-Preview.3.2.0-preview\lib\wp8\Microsoft.WindowsAzure.Storage.dll

    • I have deleted bin/obj, cleaned, rebuilt etc but to no avail.

    Is this just not supported from a Portable Library? I am not doing any form of local file access etc....

    Just need to get this working.

    Thanks!!



    Sunday, May 11, 2014 4:33 AM

All replies

  • The fact that the reference doesn't appear in the list probably has to do with the fact that the package wasn't installed at all. If you open up the NuGet reference manager, does the package show up as installed?

    Moreover, please understand that the package you are trying to install isn't targeted for WinRT and thus, required assemblies for the WindowsAzure.Storage-Preview package won't exist on the mobile devices. In other words, this package isn't meant for Windows Phone or Windows Store apps and thus, can't be added to a PCL class library project.

    You should however reference the Phone.Storage package from the Microsoft DPE team: http://www.nuget.org/packages/Phone.Storage

    Alex

    Sunday, May 11, 2014 8:44 PM
  • Hi Mang,

    Thanks for the response.

    Couple of things

    1. Yes, when I open nuget package manager it actually says the Windows Azure Storage 3.2.0-preview is installed (green check mark). Although it still only changed the config file to say it was there, but no reference ever appeared.

    I would suspect that if it wasn't the correct package, that it should fail to install, versus actually saying it succeeded but hey anything is possible :-)

    2. if I am only doing a standard Windows Phone 8 app, I can (and have) added the preview and it works just fine. I have another app that does this already.

    3. again this only happens as an issue with a PCL specifically

    Also to note

    • Originally I was trying to add version 4.0 storage client and it would fail due to the Configuration Manager error etc
    • After I installed the Preview 3.2, I just decided now to try to install 4.0. Now it actually shows successful, however it in fact doesn't provide a reference either.

    I have to manually add one, but I still have the same issue.

    Installing the 1.0 stuff (link you sent) didn't do anything as it isn't really related to my issue (of if it is, it still didn't work).

    I am wondering if this is just an issue with PCLs in general.

    Totally weird though.

    Monday, May 12, 2014 6:17 PM
  • Hi,

    I tried to reproduce this issue, and successfully installed it.

    I followed this steps:

    1.create the PortableClassLibrary project. Platform Target: .net 4.5,silverlight 5,windows 8,windows phone8.

    2.Run this command:Install-Package WindowsAzure.Storage-Preview -Pre

    PM> Install-Package WindowsAzure.Storage-PreView -Pre
    Attempting to resolve dependency 'Microsoft.Data.OData (≥ 5.6.0)'.
    Attempting to resolve dependency 'System.Spatial (= 5.6.0)'.
    Attempting to resolve dependency 'Microsoft.Data.Edm (= 5.6.0)'.
    Installing 'System.Spatial 5.6.0'.
    You are downloading System.Spatial from Microsoft Corporation, the license agreement to which is available at http://go.microsoft.com/?linkid=9809688. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
    Successfully installed 'System.Spatial 5.6.0'.
    Installing 'Microsoft.Data.Edm 5.6.0'.
    You are downloading Microsoft.Data.Edm from Microsoft Corporation, the license agreement to which is available at http://go.microsoft.com/?linkid=9809688. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
    Successfully installed 'Microsoft.Data.Edm 5.6.0'.
    Installing 'Microsoft.Data.OData 5.6.0'.
    You are downloading Microsoft.Data.OData from Microsoft Corporation, the license agreement to which is available at http://go.microsoft.com/?linkid=9809688. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
    Successfully installed 'Microsoft.Data.OData 5.6.0'.
    Installing 'WindowsAzure.Storage-Preview 3.2.0-preview'.
    You are downloading WindowsAzure.Storage-Preview from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkId=331471. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
    Successfully installed 'WindowsAzure.Storage-Preview 3.2.0-preview'.
    Adding 'System.Spatial 5.6.0' to PortableClassLibrary1.
    Successfully added 'System.Spatial 5.6.0' to PortableClassLibrary1.
    Adding 'Microsoft.Data.Edm 5.6.0' to PortableClassLibrary1.
    Successfully added 'Microsoft.Data.Edm 5.6.0' to PortableClassLibrary1.
    Adding 'Microsoft.Data.OData 5.6.0' to PortableClassLibrary1.
    Successfully added 'Microsoft.Data.OData 5.6.0' to PortableClassLibrary1.
    Adding 'WindowsAzure.Storage-Preview 3.2.0-preview' to PortableClassLibrary1.
    Successfully added 'WindowsAzure.Storage-Preview 3.2.0-preview' to PortableClassLibrary1.
     

    3. Also I found the  references had not been shown on project, so I added the 'Microsoft.WindowsAzure.Storage' from package floder. Like this:

    Also, I was able to use it on project. I suggest you could found this dll file and add into reference to try again.

    If I am misunderstanding, please let me know free.

    Regards,
    Will


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, May 15, 2014 7:20 AM
  • Hi Will,

    I am very sorry for the long delay.

    Steps:

    1. Start Visual Studio 2013 Update 2 (RC)

    2. New Project (Portable)

    3. Try to set targets to Win 8, Win Phone Silverlight 8, .Net 4.5 (works fine). There is an issue adding Silverlight 5 now (I've seen it on other peoples computers too)

    4. Project created, type

    Install-Package WindowsAzure.Storage-Preview -Pre

    Get an Error:

    Install-Package : Could not install package 'System.Spatial 5.6.0'. You are trying to install this package into a project that targets 'portable-net45+sl40+win+wp80', but the package does not contain any
    assembly references or content files that are compatible with that framework. For more information, contact the package author.
    At line:1 char:1
    + Install-Package WindowsAzure.Storage-Preview -Pre
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
        + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

    Next Steps:

    1. Try to install from Nuget Directly

    Install failed. Rolling back...
    Could not install package 'System.Spatial 5.6.0'. You are trying to install this package into a project that targets 'portable-net45+sl40+win+wp80', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
     

    And remember, this is with a totally brand new project, all I did was retarget to Windows 8, not Windows 8.1

    Next Attempt (like I did for my own)

    Install 4.01 from Nuget

    Add a reference to 3.2 (which happens to be on my machine from another project)

    And then it works.

    4.01 technically works, however the methods etc are different and I would need to refactor my code, plus 3.2 says its specifically for Windows Phone etc.

    Lastly, the whole point is to have a fully compatible portable class. If I have to manually add the reference, which has to be from a specific folder "of" the nuget package, aren't I defeating the purpose?

    So, no I cannot get it to install, but I can add a reference and make it work, but that is still.... weird

    Wednesday, May 21, 2014 12:41 PM