1

I can add my Nuget package to a standard .NET Framework project but it does not work when I try to add it to a .NET Core project.

<?xml version="1.0"?>
<package >
  <metadata>
    <id>MyPackage</id>
    <version>1.0.0</version>
    <authors>Meysam</authors>
    <owners>Meysam</owners>
    <licenseUrl>http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE</licenseUrl>
    <projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl>
    <iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>
    <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="ConsoleApp1\CustomClass\CustomClass.cs" target="content\CustomClass\CustomClass.cs" />
  </files>
</package>
3

1 Answer 1

1

I found the solution, in .net core must be used contentFiles instead content in .net framework.

<?xml version="1.0"?>
<package>
 <metadata minClientVersion="3.3.0">
    <id>MyPackage</id>
    <version>1.0.0</version>
    <authors>Meysam</authors>
    <owners>Meysam</owners>
    <licenseUrl>http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE</licenseUrl>
    <projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl>
    <iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>
    <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>

    <contentFiles>
      <files include="cs/*.*/**" buildAction="Compile" />
    </contentFiles>

  </metadata>

  <files>
    <file src="ConsoleApp1\CustomClass\CustomClass.cs" target="contentFiles\cs\any\CustomClass" />
  </files>

</package>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.