none
Generate NuGet package on build

    Question

  • When using the "Generate NuGet package on build" option in Visual Studio 2017, how do you properly include native runtime libraries. In the past, the nuspec file would reference the native DLLs, and you would include a .targets file, but it isn't clear how to replicate the functionality of the .targets file from the Package tab in the project settings. Are there any examples of this anywhere?
    Wednesday, March 7, 2018 11:13 PM

All replies

  • Hi jackhanbond,

    >>> how to replicate the functionality of the .targets file from the Package tab in the project settings. Are there any examples of this anywhere?

    The answer is yes, but we could not including the .targets file directly from Package tab in the project settings. As you can see in the Package tab, the package tab only contains some basic nuget package information settings. If you want to include native runtime libraries, you can add following code in your project file .csproj file:

      <ItemGroup>
        <None Include="ClassLibrary1.targets">
          <Pack>true</Pack>
          <PackagePath>build</PackagePath>
        </None>
      </ItemGroup>

    Then you pack your project, MSBuild will include the .targets file into the build folder:

    See NuGet pack and restore as MSBuild targets for more details.


    MSDN Community Support Please remember to click Mark as Answer. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, March 9, 2018 2:25 AM
  • Hi jackhanbond,

    Any update for this issue? Have you resolved it? If not, could you please let me know the latest status of this issue?


    MSDN Community Support Please remember to click &quot;Mark as Answer&quot; the responses that resolved your issue, and to click &quot;Unmark as Answer&quot; if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, March 21, 2018 6:15 AM