ʃʈɑɲ
ʃʈɑɲ

Reputation: 2684

Migrate from PCL to .netstandard

I'm trying to figure out how to migrate a project from PCL to .netstandard 1.2.

I have a solution where I have a PCL project (portable45-net45+win8+wpa81) and a .Net Standard (netstandard1.2) project which has all it files linked into the PCL project.

Currently we create a nuget package from the PCL project using a nuspec file. Now what would be the best approach to have both available in 1 nuget package? I find the use of nuget pack vs dotnet pack and mixing multiple frameworks and project types (csproj) very confusing.

Also appearantly there is a new csproj format for VS2017+ projects, should I convert the PCL project?

Eventually the nuget should only contain the .netstandard1.2 project but we want to take both up the dependency tree during migration.

Upvotes: 2

Views: 300

Answers (1)

Leo Liu
Leo Liu

Reputation: 76750

what would be the best approach to have both available in 1 nuget package?

You can still use .nuspec file to accomplish this, just need include the dll files from PCL project and .Net Standard project into different frameworks.

Following is my test .nuspec file, you can check it for details:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>My.Package</id>
    <version>1.0.0</version>
    <authors>Tester</authors>
    <owners>Tester</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Package description</description>
    <releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
    <copyright>Copyright 2018</copyright>
    <tags>Tag1 Tag2</tags>
  </metadata>
    <files>
       <file src="TestPCL\bin\Debug\TestPCL.dll" target="lib\portable-net45+wp8\" />
       <file src="TestStandard\bin\Debug\netstandard1.2\TestStandard.dll" target="lib\netstandard1.2\" />
    </files>
</package>

When you install this package to the PCL project and .Net Standard project, nuget will select the DLL file under the corresponding framework to your project.

Upvotes: 1

Related Questions