Is there any guidance on converting existing .NET class libraries to portable libraries?

别来无恙 提交于 2019-11-28 15:57:55
DerDani81

We also converted existing libraries to portable libraries and it works fine. You have to modify the project file. Replace the following line:

<Import Project="..." />

with

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />

Add following line inside a PropertyGroup tag

<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

And remove following lines from the AssemblyInfo.cs file

[assembly: ComVisible(false)]
[assembly: Guid("...")]

After that, Visual Studio should show you the Tab page "Library" in the project Property page and you can change the target frameworks for the portable library.

Martin Poehler

I created a Visual Studio Extension to automate this. Just search in Visual Studio > 2012 in Extension for "convert to pcl"

The source code is also available on Github.

You can delete the <Import Project="..." /> line. Then, when you reload the project, Visual Studio will ask you which frameworks to target. You can then change this later in the project's properties.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!