none
“Error MSB4057 missing target pack” when building .netstandard nuget package

    Question

  • I'm trying to create a .netstandard nuget package following these instructions, using VS2017 RC. It builds fine, but when I try to create the package using

    msbuild /t:pack /p:Configuration=Release

    I get an error, that the "target pack" is not availiable in my solution: (sorry for the german)

    error MSB4057: Das Ziel "pack" ist im Projekt nicht vorhanden.

    I'm not really sure what to do with this message or where I should be looking to fix it. Any suggestions?

    Wednesday, December 21, 2016 10:37 PM

Answers

  • Hi Thomas,

    >>I get an error, that the "target pack" is not available in my solution: (sorry for the German)

    According to the error log, you should switch the .sln solution path to the appropriate .csproj project path when you packing your package. Because the package metadata is contained directly in the .csproj file.

    According to the instructions , the pack path should be in the same directory of the file AppLogger.csproj rather than solution file AppLogger.sln. The default pack path should be: C:\Users\${username} \Documents\visual studio 2017\Projects\AppLogger\AppLogger.

    So you can write the .csproj file path in the command line directly:

    msbuild "C:\Users\Administrator\Documents\visual studio 2017\Projects\AppLogger\AppLogger\AppLogger.csproj" /t:pack /p:Configuration=Release

    Best Regards,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" 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.



    Monday, December 26, 2016 5:45 AM
    Moderator

All replies

  • Hi Thomas,

    Based on your description, your case more related to Nuget, I will help move your case to an appropriate  forum for better support.

    Best regards,

    Kristin


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" 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.



    • Edited by Kristin Xie Thursday, December 22, 2016 6:06 AM
    Thursday, December 22, 2016 6:05 AM
  • Hi Thomas,

    >>I get an error, that the "target pack" is not available in my solution: (sorry for the German)

    According to the error log, you should switch the .sln solution path to the appropriate .csproj project path when you packing your package. Because the package metadata is contained directly in the .csproj file.

    According to the instructions , the pack path should be in the same directory of the file AppLogger.csproj rather than solution file AppLogger.sln. The default pack path should be: C:\Users\${username} \Documents\visual studio 2017\Projects\AppLogger\AppLogger.

    So you can write the .csproj file path in the command line directly:

    msbuild "C:\Users\Administrator\Documents\visual studio 2017\Projects\AppLogger\AppLogger\AppLogger.csproj" /t:pack /p:Configuration=Release

    Best Regards,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" 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.



    Monday, December 26, 2016 5:45 AM
    Moderator
  • Thanks for the tip, that led me to the right path.

    Additionally I needed to install the "NuGet.Build.Tasks.Pack" package from NuGet.

    Monday, December 26, 2016 4:59 PM