Soumika
Soumika

Reputation: 65

How to convert a VB.Net project to .NetCore

How to convert my vb.net project into .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.

.NetCore supports VB and I assume no code change is required for conversion. But I didn't get any option to convert my vb project to .NetCore .My project is in .Net Framework 4.5 . Do I need to convert to latest .Net Framework before conversion? Is there any visual studio plugins available for conversion (to .net framework and then to .Net Core)?

Thanks in advance .

Upvotes: 4

Views: 3685

Answers (1)

RQDQ
RQDQ

Reputation: 15579

I would recommend updating your project file (.vbproj) to the new format. Here is an example of a netstandard2.0 project file:

<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.

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).
  • 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.

Upvotes: 1

Related Questions