是否有转换现有的.NET类库便携式库中的任何指导? [英] Is there any guidance on converting existing .NET class libraries to portable libraries?

查看:135
本文介绍了是否有转换现有的.NET类库便携式库中的任何指导?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有现有的代码不平凡的量一些类库。该类库目前面向.NET 4.0。是否有关于如何将这些库转换为可移植库中的任何指导?从看的.csproj,它不会出现有很大的分歧:

 <导入项目= $(MSBuildExtensionsPath32)\Microsoft\Portable\ $(TargetFrameworkVersion)\Microsoft.P​​ortable.CSharp.targets/> 

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



这是个好或坏的主意,试图把现有的类库是一个便携式库?


解决方案

我们也将转换现有的库便携图书馆,它工作正常。你必须修改项目文件。替换以下行:

 <导入项目=.../> 



 <导入项目=$(MSBuildExtensionsPath32)\Microsoft\Portable\ $(TargetFrameworkVersion)\Microsoft.P​​ortable.CSharp.targets/> 



添加以下线的PropertyGroup标签



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

和从AssemblyInfo.cs中删除以下文件行

  [汇编:标记有ComVisible特性(假)] 
[总成:GUID(...)

之后,Visual Studio中应该表现出你的标签页库项目中的属性页,你可以改变目标框架便携库。


I have some class libraries with a non-trivial amount of existing code. The class libraries currently target .NET 4.0. Is there any guidance on how to convert these libraries to be portable libraries? From looking at the .csproj, it doesn't appear that there are a lot of differences:

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

and

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

Is it a good or bad idea to try converting an existing class library to be a portable library?

解决方案

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.

这篇关于是否有转换现有的.NET类库便携式库中的任何指导?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆