Bug 57788 - msbuild /t:Pack doesn't work even after pack sdk is included
Summary: msbuild /t:Pack doesn't work even after pack sdk is included
Alias: None
Product: Tools
Classification: Mono
Component: msbuild ()
Version: 5.4 (2017-06)
Hardware: PC Mac OS
: --- normal
Target Milestone: 15.4
Assignee: Ankit Jain
Depends on:
Reported: 2017-06-27 13:02 UTC by Alexander Köplinger [MSFT]
Modified: 2017-06-27 19:24 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Alexander Köplinger [MSFT] 2017-06-27 13:02:27 UTC
We added the SDK with https://bugzilla.xamarin.com/show_bug.cgi?id=57776 but it doesn't seem to be working:

Note that you need to remove/rename /usr/local/share/dotnet/sdk/2.0.0-preview1-005977/Sdks/NuGet.Build.Tasks.Pack or our msbuild will fallback to that.

> $ cat msbuildpacktest.csproj
> <Project Sdk="Microsoft.NET.Sdk">
>   <PropertyGroup>
>     <TargetFrameworks>netstandard20;net45</TargetFrameworks>
>   </PropertyGroup>
> </Project>
> $ cat Class1.cs
> using System;
> namespace msbuildpacktest
> {
>     public class Class1
>     {
>     }
> }
> $ msbuild /t:Pack
> Microsoft (R) Build Engine version (xplat-master/f7dcc39 Tue Jun 27 03:00:17 EDT 2017) for Mono
> Copyright (C) Microsoft Corporation. All rights reserved.
> Build started 6/27/2017 2:57:18 PM.
> Project "/Users/alexander/dev/test/msbuildpacktest/msbuildpacktest.csproj" on node 1 (Pack target(s)).
> /Users/alexander/dev/test/msbuildpacktest/msbuildpacktest.csproj : error MSB4057: The target "Pack" does not exist in the project.
> Done Building Project "/Users/alexander/dev/test/msbuildpacktest/msbuildpacktest.csproj" (Pack target(s)) -- FAILED.
> Build FAILED.
> "/Users/alexander/dev/test/msbuildpacktest/msbuildpacktest.csproj" (Pack target) (1) ->
>   /Users/alexander/dev/test/msbuildpacktest/msbuildpacktest.csproj : error MSB4057: The target "Pack" does not exist in the project.
>     0 Warning(s)
>     1 Error(s)
> Time Elapsed 00:00:00.32
Comment 1 Ankit Jain 2017-06-27 18:45:41 UTC
I removed everything under `/usr/local/share/dotnet/sdk`.
It works for me with with
Microsoft (R) Build Engine version (xplat-master/f7dcc39 Tue Jun 27 12:02:31 EDT 2017) for Mono

 $ msbuild /t:Restore,Build
 $ msbuild /t:Pack

And in the log I checked that it is using `/Library/Frameworks/Mono.framework/Versions/5.4.0/lib/mono/msbuild/15.0/bin/Sdks/NuGet.Build.Tasks.Pack/...` .

Which mono version did you try?
Comment 2 Alexander Köplinger [MSFT] 2017-06-27 19:24:57 UTC
Yes, my error was that I just renamed the /usr/local/share/dotnet/sdk/2.0.0-preview1-005977/Sdks/NuGet.Build.Tasks.Pack folder. If I remove everything it uses our stuff correctly.