Portable Library Tools 2

Microsoft Free

Provides tools for Visual Studio 2010 for creating class libraries that run on Windows, Silverlight, Windows Phone and Xbox 360.

Microsoft
(25) Review
Visual Studio
2010
Download (65,313)
9/21/2012
10.0.50828
E-mail Twitter del.icio.us Digg Facebook
Add to favorites
Description
Reviews (25)
Q and A (128)
Sign in to write a review
Sort by:

by Yoru No Tori | September 18 2013

I ve got Visual studio 2012, would be nice to have this tool for this version of the software... :O please???

by Kiếm Tiên - Diệp Nhược Ca | January 02 2013

Microsoft Visual Studio 2010 (with SP1) must be installed before installing Portable Library Tools 2 for Visual Studio 2010.
But I installed Microsoft Visual Studio 2010 SP1. What is problem?

by Caio Vilas Boas | December 07 2012

Works great, but would be nice to have Silverlight support.

by modalove | September 18 2012

Amazing Tool! but -1 for testability.
Thank you so much

by rick.duarte-br | September 12 2012

System.ComponentModel.DataAnnotations is not available for Windows Phone.

by Jonas Kello | July 24 2012

Perfect! Now we can use the FieldOffset attribute! Thank you for releasing this!

by Another Developer Guy | July 18 2012

This is probably the most useful tool that I have ever used. I hate cluttering my code #if. Keep up the excellent work!

This can support assembly sharing for all the major platforms Android/Silverlight/iOS/WP/Metro/.NET/Xbox. Developer's paradise!

by Lidan Hackmon | May 26 2012

Amazing tool. Still, there are some missing objects.
Mainly:
ObservableCollection (cannot be shared with PC .Net 4)
WebClient

Edit:
The latest release contains ObservableCollection! This is awesome!
I'm actually able to share the same project between Windows Phone, PC and WCF service of the same application.

Thumbs up BCL Team.
Lidan.

by The Thinker | May 19 2012

Great!

by George Danila | May 13 2012

Excelent :D

by Brian Swiger | March 19 2012

Great addition that was desperately needed for multi-platform. It's not perfect yet, but is a great stride forward to delivering a cross-platform runtime. Please keep adding namespaces such as the new ones introduced in .NET 4 and 4.5. Thank you!

by Mike Feng | March 07 2012

It is great tool, but as the other said, please add the namespace System.XML.Linq and System.ComponentModel.DataAnnotations.dll since they are available in new .net framework. http://support.microsoft.com/kb/2600211

BCL Team May 09 2012
| Edit |
Delete

The new update includes support for these, when targeting platforms that support it (.NET 4.0.3, Silverlight, Phone and .NET for Metro style apps).

by Daniel B Holt | February 25 2012

by Xperiandri | January 04 2012

Could you add Silvelight 5 support?

by Zverev Eugene | December 19 2011

Extremelly needed tool.

by MikeBMcL | November 20 2011

This is an extremely useful tool. It has helped me a lot when designing data models for projects where the target platforms have not yet been finalized and where leaving open the option to add additional platforms in the future is desirable.

by Jonathan Allen | November 14 2011

I love the idea, but as it stands I can't use it. At the very least I need "View Model Support" across .NET, Silverlight, and Windows Phone.

BCL Team May 09 2012
| Edit |
Delete

In the latest update, support for sharing View Model is available between .NET 4.5 and the other platforms.

by ealbert1 | September 19 2011

For the purpose of validating the Models/Dtos both in the UI and server side, it would be beneficial if IDataErrorInfo is available.

by Jozef Izso | September 14 2011

by Alex F. Sherman | September 08 2011

1 - 20 of 25 Items   
Sign in to start a discussion


  • System.Numerics.BigInteger and System.Numerics.Complex
    1 Posts | Last post August 05, 2014
    • Looks very strange, that BigInteger and Complex types are available in Profile 111 (Net 4.5, Win8, WP8.1) and Profile 47 (Net 4.5, Win8, Silverlight 5), but is not available in Profile 255 (Net 4.5, Win8, Silverlight 5, WP8.1) that is just combination of two previous.
  • .resx breaks portability ?
    3 Posts | Last post June 15, 2014
    • Hello,
      
      I'm trying to share some .resx files (public, EmbeddedResource) thru a PCL (between SL and .NET), but when I try to load some resource in SL, I get: 
      Error 4004 - System.IO.FileNotFoundException - Could not load file or assembly '<PCL_assemblyname>'.
      
      If I just have some constants in PCL, it works OK. I googled for more than an hour, but couldn't find any direction to go. Did anybody had a similar problem ?
      
      Thanks,
      Leandro 
      
      
    • Oooops, looks like I fell into a bug where your namespace/assembly can't be called xxx.resources... Pretty weird... Anyway, solved now !
    • That's a crazy gotcha - I just ran in to it myself with Visual Studio 2013, Silverlight / ASP.NET project with a Portable Class Library named "[something].Resources". Gotta love those..
  • INotifyCollectionChanged
    1 Posts | Last post May 16, 2014
    • Why is INotifyCollectionChanged missing when the project target includes both Silverlight 5 and Windows Phone 8.l (with or without any other target combination)?
  • WP 7.1 APIs not visible
    5 Posts | Last post April 16, 2013
    • Are there any plans to support the System.Net.Sockets namespace in the future?
    • Thanks for the feedback Andreas, we'll consider including them in a future update.
    • Hi David
      
      Thanks, that's good to hear. I guess supporting the mentioned namespace would require the addition of WP 7.1 as a 5th platform, right?
      
      Regards,
      
      Andreas
    • Hello.
      
      What's the status of Socket support? It's really needed for portable game engine development.
    • There are no plans to add Socket support anytime soon.
  • PCL in VS2012 incorrectly resolves mscrolib version in netmodule references
    7 Posts | Last post February 16, 2013
    • I have two PCL libraries with the same profile (88). One library is a netmodule (/terget:module) and the second one is a normal dll. The second library has a project reference to the first library. After tinkering with .csproj, the libraries build fine, but I get the following warnings:
      
      2>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3268: The primary reference "A:\_All\My.Creativity.Coding\Ark.Pipes\Ark.Weak\bin\Debug\Ark.Weak.netmodule" could not be resolved because it has an indirect dependency on the framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile88". To resolve this problem, either remove the reference "A:\_All\My.Creativity.Coding\Ark.Pipes\Ark.Weak\bin\Debug\Ark.Weak.netmodule" or retarget your application to a framework version which contains "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
      2>  Primary reference "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes".
      2>      Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile\Profile88\mscorlib.dll".
      2>      Reference found at search path location "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile\Profile88\mscorlib.dll".
      
      
      Here is the csc.exe command line for the netmodule:
      
      C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /errorendlocation /preferreduilang:en-US /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile\Profile88\mscorlib.dll" ---skipped--- /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\Ark.Weak.netmodule /target:module /utf8output Ark\DelegateExtens
    • This looks like a C# bug, it's outputting a reference to the wrong Mscorlib. Investigating and will get back to you.
    • Hmmm. Looks like you're right. ILdasm shows two mscorlib references.
      .assembly extern retargetable mscorlib
      {
        .publickeytoken = (7C EC 85 D7 BE A7 79 8E )
        .ver 2:0:5:0
      }
      .assembly extern mscorlib as mscorlib_2
      {
        .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
        .ver 4:0:0:0
      }
    • Spoke to the compiler team. They are aware of the bug, and were unable to fix it this release due to compatibility requirements (they actually attempted to fix it and had to roll it back because a few internal teams broke because of it).
      
      Unfortunately, I don't have a very good workaround, other than manually stripping the reference via something like ildasm/ilasm. :(
      
    • Thanks for the info. Turned out, netmodules are not suitable for my goal (I needed ILmerge instead), so that's no longer a problem for me.
    • Hi David,
      
      is there a connect issue to track this bug?
      Are there any known circumstances for this bug to arise or not?
      
      Also other projects now have this problem (e.g. https://oxyplot.codeplex.com/discussions/431821).
    • I have created a Microsoft Connect issue:
      https://connect.microsoft.com/VisualStudio/feedback/details/779370/vs2012-incorrectly-resolves-mscorlib-version-when-referencing-pcl-assembly
  • Inheritence from ObservableCollection<T> work SL5 but not .NET 4.5
    10 Posts | Last post January 23, 2013
    • When defining the BaseObservable below in a Portable Library (target: SL 5.0 & .NET 4.5):
      
      public interface IChild
      {
              string Name { get; set; }
      }
      
      public class BaseObservable<T> : ObservableCollection<T> where T : IChild
      {
      }
      
      The code works fine when referencing the portable library from SL5, but when I reference it from a .NET (4.5) class library I get the following error:
      
      The type 'System.Collections.ObjectModel.ObservableCollection`1<T0>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.
    • For reference: 
      
      I'm using VS 2012
      Version 11.0.51106.01 Update 1
      Microsoft .NET Framework
      Version 4.5.50709
      
    • You need to add a reference to System.Windows (new for 4.5) from the .NET 4.5 project. It's needed to tell the compiler where the "real" location of ObservableCollection<T> is.
    • Great David, thanks for a fast reply, you just made my day!
      
      Is there any documentation where this kind of info could be found that I have missed?
    • With this particular issue, no. Is there any reason you didn't make the connection between the error message and adding the reference itself? (so that we can see if we can clear that up somehow?)
    • I think I was just so focused on that it worked so well when I compiled against the SL5 platform and the stress of a major refactoring was in vain, that I thought there was some mismatch in the portability lib, so that I had to go and play some ping pong. When I arrived back you have already given me the answer to my prayers. :)
      
      A small 5 point list troubleshooter with common pitfalls, if possible would be great! 
      
      Thanks again and have a nice day!
      
      
    • Can I get a clarification on this solution, please?  The error says it's expecting system.windows 2.0.5...I have the same issue (portable library targeting 4.5 + SL5 + Store Apps - referenced by a 4.5 project), but I have a reference to system.windows in my framework 4.5 project (version 4.0...I don't see system.windows 4.5)...point being, it seems to want an OLD version of system.windows...I see that this relates to another thread here where there is an incorrect mscorlib being referenced...Is there an easy way out of this box?  Note - it only happens when I add Silverlight 5 to the portable library.  If I compile with 4.5 + Store Apps then it works just fine...
      
      I'm really at a loss without a solution to this...I can do an IList workaround, but then I lose the collection changed events.
    • Unfortunately, we couldn't get this error message fixed to state what it is actually expecting. Adding a reference to the 4.0.0.0 version of System.Windows is correct.
    • Well, I came in today renamed some projects, and closed and re-opened the solution and now it's building fine (it didn't make sense that it didn't work in the first place)...There seems to be some issues with modifying the project targeting not getting flushed/rebuilt correctly.  Now I'm being told that types defined in "system.runtime" are not available, i.e. System.Enum, System.Action, etc...Not having as much luck here, but I assume it will work out with enough cleaning, closing, etc...
      
      Thanks for the response...
    • I take that back...Most of it, anyway - I did something stupid and didn't add the System.Windows reference in another assembly...The System.Enum thing was still weird though, and has fixed itself after deleting all obj and bin folders.
      
      Thanks again.
  • Covariance/contravariance on WP7 platforms.
    1 Posts | Last post January 12, 2013
    • Can something be done with interface covariance/contravariance? When I add WP7 as a supported platform, the life gets harder since I can no longer use covariance/contravariance. I thought that it was supported by CLR/IL for a long tome, but was only added to C# in the 4.0 version. Can you please add support for that for the WP7 platform?
      
      example code which doesn't compile for WP7:
      new List<object>().AddRange(new List<string>());
  • PCL does not include WindowsRuntimeSystemExtensions
    1 Posts | Last post December 15, 2012
    • I'm trying to create a Portable Class Library with the following line of code in it:
      
      StorageFolder guidesLocalFolder = await ApplicationData.Current.LocalFolder.GetFolderAsync(guidesFolder);
      
      This requires the GetAwaiter method which is found in the WindowsRuntimeSystemExtensions class in the System.Runtime.WindowsRuntime.dll, but this dll is not available in the .NET Portable Subset. This seems strange to me as it is in the .NET for Windows Store apps component set and in the Windows Phone 8 component set, which are the two platforms I'm trying to target, would it be possible for Microsoft to add it, or is there some other constraint I'm missing? 
  • MessageContractAttribute isWrapped not defined ?
    2 Posts | Last post December 04, 2012
    • Hello,
      I'm attempting to create a Portable Library project which can be leveraged by both Silverlight and WPF applications. I have added a Service Reference for a 3rd party Web Service to my Portable project, but I'm running into a problem. Now, my SOAP request has a Wrapper on it, which causes the web service request to fail - malformed SOAP request / unexpected elements.
      
      I investigated the auto-generated client stub code and it seems there's a subtle difference between how it is generated in a regular Silverlight project and how it appears in a PCL project:
      
      
      Client Stub in Portable Library project:
      
          [System.Diagnostics.DebuggerStepThroughAttribute()]
          [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
          [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
          [System.ServiceModel.MessageContractAttribute()]
      
      
      Client Stub in regular Silverlight project:
      
          [System.Diagnostics.DebuggerStepThroughAttribute()]
          [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
          [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
          [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
      
      
      I tried modifying the client stub and adding the "IsWrapped=false" property, but that property is undefined in the Portable project! Can anyone tell me why this is?
      Is there a work-around, so that I can force the SOAP request not to include the wrapper ?
      
      Thanks,
      Joe.
      
    • Can anyone help with this? I'm guessing at this point that this is a limitation that can't be easily worked around ?
  • await error when returning TaskAwaiter<T> from PCL
    5 Posts | Last post November 06, 2012
    • One of my types in my PCL (net4+win8+sl4+wp71) library returns a TaskAwaiter<T> when its GetAwaiter() is called.
      
      I'm trying to consume this using await in a unit test project (net45), but I get an interesting error:
      
      'System.Runtime.CompilerServices.TaskAwaiter`1<int>' does not contain a definition for 'IsCompleted'
      
      I've tried adding an app.config (as a side note, it looks like if you binding-redirect System.Runtime, then VS "loses" all the tests), and referencing MS.Bcl.Async, but the error persists.
    • I can repro this internally. I'm not sure of the cause around this, I've filed a bug and we'll investigate.
    • Okay, I figured this out - the compiler is failing to complain that you need to reference Microsoft.Threading.Tasks.dll. It fails to resolve TaskAwaiter which lives in Microsoft.Threading.Tasks, hence, can't find its IsCompleted property.
      
      As a workaround, add a manual reference to Microsoft.Threading.Tasks from the package (it doesn't matter to which one) and this will build successfully. Make note, it's not a matter of referencing Microsoft.Bcl.Async from 4.5, because we don't install any binaries for 4.5 projects.
    • Thanks for your help, David!
      
      Unfortunately, my unit test project also uses Task.Yield, and when I add a reference to Microsoft.Threading.Tasks.dll from MS.Bcl.Async, I get this error:
      
      The type 'System.Runtime.CompilerServices.YieldAwaitable' exists in both '...\packages\Microsoft.Bcl.Async.1.0.12-beta\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.dll' and 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll'
      
      I tried to make my own .NET 4.5 Microsoft.Threading.Tasks.dll just doing a type forward of TaskAwaiter<> to mscorlib, but couldn't get that working (it still has the 'IsCompleted' error).
      
      I'm currently working around this by just defining my own awaiter type instead of using TaskAwaiter<>.
    • Yep, do that for now. We spoke yesterday of a way to avoid this, and we should have a fix in the next update.
1 - 10 of 128 Items