简体   繁体   English

如何将 VB.Net 项目转换为 .NetCore

[英]How to convert a VB.Net project to .NetCore

How to convert my vb.net project into .NetCore .如何将我的 vb.net 项目转换为 .NetCore 。

I have used .NET Portability Analyzer extension from the Visual Studio Marketplace and it shows most of the solutions have more than 90% portability.我使用了来自 Visual Studio Marketplace 的 .NET Portability Analyzer 扩展,它显示大多数解决方案具有超过 90% 的可移植性。

.NetCore supports VB and I assume no code change is required for conversion. .NetCore 支持 VB,我假设转换不需要更改代码。 But I didn't get any option to convert my vb project to .NetCore .My project is in .Net Framework 4.5 .但是我没有任何选项可以将我的 vb 项目转换为 .NetCore 。我的项目在 .Net Framework 4.5 中。 Do I need to convert to latest .Net Framework before conversion?转换前是否需要转换为最新的 .Net Framework? Is there any visual studio plugins available for conversion (to .net framework and then to .Net Core)?是否有任何 Visual Studio 插件可用于转换(到 .net 框架,然后到 .Net Core)?

Thanks in advance .提前致谢 。

I would recommend updating your project file (.vbproj) to the new format.我建议将您的项目文件 (.vbproj) 更新为新格式。 Here is an example of a netstandard2.0 project file:下面是一个netstandard2.0项目文件的例子:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <RootNamespace>VbTest</RootNamespace>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\ClassLibrary1\ClassLibrary1.vbproj" />
  </ItemGroup>

</Project>

I've typically done this as a manual process when upgrading c# projects.在升级 c# 项目时,我通常将其作为手动过程完成。

Easy parts:容易的部分:

  • All source files are included by default and don't require explicit entries.默认情况下包含所有源文件,不需要显式条目。

Harder parts:较硬的部分:

  • References need to be moved from packages.config to the project file (then delete packages.config ).需要将引用从packages.config移动到项目文件(然后删除packages.config )。
  • Project references will also need to be manually moved over to the new format.项目引用也需要手动移动到新格式。 Can do this by hand in a text editor, or add them using your IDE.可以在文本编辑器中手动执行此操作,或使用您的 IDE 添加它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM