Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NuGet pack fails with 'The method or operation is not implemented.' #1946

Closed
phrohdoh opened this issue Jan 19, 2016 · 55 comments
Closed

NuGet pack fails with 'The method or operation is not implemented.' #1946

phrohdoh opened this issue Jan 19, 2016 · 55 comments
Labels
Functionality:Pack Platform:Mono NuGet.exe on mono scenarios Resolution:Duplicate This issue appears to be a Duplicate of another issue Type:Feature
Milestone

Comments

@phrohdoh
Copy link

NuGet Version: 3.3.0.212
Latest from the downloads page is 3.3.0.

OS X 10.11.2
Mono 4.2.1

<!-- tmba:OpenRA.Mods.Common thill $ cat OpenRA.Mods.Common.nuspec -->
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata>
    <id>OpenRA.Mods.Common</id>
    <version>20151224.0.0</version>
    <title>OpenRA.Mods.Common</title>
    <authors>OpenRA</authors>
    <owners>OpenRA</owners>
    <licenseUrl>https://www.gnu.org/licenses/gpl-3.0.txt</licenseUrl>
    <projectUrl>https://github.com/OpenRA/OpenRA/</projectUrl>
    <iconUrl>http://www.openra.net/images/soviet-logo.svg</iconUrl>
    <requireLicenseAcceptance>true</requireLicenseAcceptance>
    <description>OpenRA's Mods.Common built for release-20151224</description>
    <releaseNotes>https://github.com/OpenRA/OpenRA/wiki/Historical-Changelogs#20151224</releaseNotes>
    <language>en-US</language>
    <tags>OpenRA</tags>
  </metadata>
  <files>
    <file src="../mods/common/*.dll" target="lib"/>
  </files>
</package>

Per creating and publishing:
You need to run 'nuget pack' on the project file, not the nuspec itself. But the nuspec will in fact get picked up.

tmba:OpenRA.Mods.Common thill $ nuget pack OpenRA.Mods.Common.csproj -IncludeReferencedProjects
MSBuild auto-detection: using msbuild version '4.0' from '/Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5'.
Attempting to build package from 'OpenRA.Mods.Common.csproj'.
The method or operation is not implemented.
tmba:OpenRA.Mods.Common thill $ pwd ; ls
/Users/thill/projects/openra/OpenRA.Mods.Common
total 168
drwxr-xr-x   31 thill  staff   1054 Jan 18 19:36 ./
drwxr-xr-x   82 thill  staff   2788 Jan 18 12:46 ../
drwxr-xr-x   30 thill  staff   1020 Jan 18 12:26 Activities/
-rw-r--r--    1 thill  staff   4256 Nov 28 07:36 ActorExts.cs
drwxr-xr-x   10 thill  staff    340 Jan 18 12:26 AI/
drwxr-xr-x    3 thill  staff    102 Jan 12 20:24 bin/
drwxr-xr-x    6 thill  staff    204 Jan 12 20:28 Commands/
drwxr-xr-x    7 thill  staff    238 Jan 18 12:26 EditorBrushes/
drwxr-xr-x   19 thill  staff    646 Jan 18 12:26 Effects/
drwxr-xr-x    7 thill  staff    238 Jan 17 17:31 FileFormats/
drwxr-xr-x   14 thill  staff    476 Jan 18 12:26 Graphics/
drwxr-xr-x    6 thill  staff    204 Jan 12 20:28 HitShapes/
-rw-r--r--    1 thill  staff   4543 Jan 12 20:28 InstallUtils.cs
drwxr-xr-x   20 thill  staff    680 Jan 18 12:26 Lint/
drwxr-xr-x    5 thill  staff    170 Jan 18 12:26 LoadScreens/
drwxr-xr-x    3 thill  staff    102 Jan 12 20:24 obj/
-rw-r--r--    1 thill  staff  41445 Jan 17 22:41 OpenRA.Mods.Common.csproj
-rw-r--r--    1 thill  staff    872 Jan 18 12:49 OpenRA.Mods.Common.nuspec
drwxr-xr-x   11 thill  staff    374 Jan 18 12:26 Orders/
drwxr-xr-x   10 thill  staff    340 Jan 18 12:26 Pathfinder/
-rw-r--r--    1 thill  staff    823 Jan  2 19:01 PlayerExtensions.cs
drwxr-xr-x    9 thill  staff    306 Jan 18 12:26 Scripting/
drwxr-xr-x    7 thill  staff    238 Jan 18 12:26 ServerTraits/
-rw-r--r--    1 thill  staff    978 Jan 12 20:28 ShroudExts.cs
drwxr-xr-x    7 thill  staff    238 Jan 17 17:31 SpriteLoaders/
drwxr-xr-x  105 thill  staff   3570 Jan 18 12:26 Traits/
-rw-r--r--    1 thill  staff   3718 Jan 18 12:26 TraitsInterfaces.cs
drwxr-xr-x   25 thill  staff    850 Jan 18 12:26 UtilityCommands/
drwxr-xr-x   11 thill  staff    374 Jan 18 12:26 Warheads/
drwxr-xr-x   51 thill  staff   1734 Jan 18 12:26 Widgets/
-rw-r--r--    1 thill  staff   4478 Jan 12 20:28 WorldExtensions.cs
@emgarten
Copy link
Member

@phrohdoh would you re-run pack with -verbosity detailed and paste the output? It should include the stack trace which will help narrow down here this is coming from.

@phrohdoh
Copy link
Author

Sure!

tmba:OpenRA.Mods.Common thill $ nuget pack OpenRA.Mods.Common.nuspec -verbosity detailed
MSBuild auto-detection: using msbuild version '4.0' from '/Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
Attempting to build package from 'OpenRA.Mods.Common.nuspec'.
System.InvalidOperationException: Cannot create a package that has no dependencies nor content.
  at NuGet.PackageBuilder.Save (System.IO.Stream stream) <0x38aab58 + 0x00307> in <filename unknown>:0
  at NuGet.CommandLine.PackCommand.BuildPackage (NuGet.PackageBuilder builder, System.String outputPath) <0x38a9580 + 0x0014b> in <filename unknown>:0

ref #1874 (comment)

@emgarten
Copy link
Member

That looks like a different exception. It could be nuget.exe going down a different path with the verbosity change, but just to be sure would you double check your files path and make sure it's not creating an empty package like it says there.

@yishaigalatzer
Copy link

The second run was on the .nuspec and not the project. Can you please run the exact same command as the first one with verbosity turned on?

@phrohdoh
Copy link
Author

Oh wow that's an embarrassing mistake.
I'll run this again over lunch and see what happens.

@phrohdoh
Copy link
Author

Here is the correct output.

tmba:OpenRA.Mods.Common thill $ nuget pack OpenRA.Mods.Common.csproj -IncludeReferencedProjects -verbosity detailed
MSBuild auto-detection: using msbuild version '4.0' from '/Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
Attempting to build package from 'OpenRA.Mods.Common.csproj'.
System.NotImplementedException: The method or operation is not implemented.
  at (wrapper dynamic-method) System.Object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object)
  at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid1[T0] (System.Runtime.CompilerServices.CallSite site, System.Dynamic.T0 arg0) <0x3ed2560 + 0x003ee> in <filename unknown>:0
  at NuGet.CommandLine.ProjectFactory.ResolveTargetPath () <0x3ece960 + 0x0094e> in <filename unknown>:0
  at NuGet.CommandLine.ProjectFactory.BuildProject () <0x3ece3f8 + 0x0044f> in <filename unknown>:0
  at NuGet.CommandLine.ProjectFactory.CreateBuilder (System.String basePath) <0x3ecd9e0 + 0x0004f> in <filename unknown>:0
  at NuGet.CommandLine.PackCommand.BuildFromProjectFile (System.String path) <0x36e0970 + 0x0023f> in <filename unknown>:0
  at NuGet.CommandLine.PackCommand.BuildPackage (System.String path) <0x36e08f0 + 0x0005f> in <filename unknown>:0
  at NuGet.CommandLine.PackCommand.ExecuteCommand () <0x36dab58 + 0x001f7> in <filename unknown>:0
  at NuGet.CommandLine.Command.ExecuteCommandAsync () <0x36dab28 + 0x00010> in <filename unknown>:0
  at NuGet.CommandLine.Command.Execute () <0x36c6090 + 0x001e4> in <filename unknown>:0
  at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) <0x696b58 + 0x0065c> in <filename unknown>:0

I get the same output if I omit the -IncludeReferencedProjects flag.

@yishaigalatzer
Copy link

OK, I see. msbuild is not supported on mono, you are supposed to use xbuild instead. I need to find out why xbuild is not kicking in for you

@csharpfritz csharpfritz added this to the Client-VNext milestone Jan 19, 2016
@csharpfritz csharpfritz added Type:Feature help wanted Considered good issues for community contributions. labels Jan 19, 2016
@csharpfritz
Copy link
Contributor

NuGet has not previously supported packing from a csproj outside of Windows. We are currently focused on delivering pack functionality using nuspec with the CoreCLR on Mac. Csproj file support currently requires MSBuild, which is not present on Mac

@phrohdoh
Copy link
Author

Okay, should I open a separate issue for the failure of nuget pack myspec.nuspec which is also caused by the xbuild issue?

If I could get a bit of help I'd be willing to put some hours into solving this but currently I am dead in the water waiting for a fix.

@yishaigalatzer
Copy link

I believe the error there is correct, and you need to fully fill in the nuspec by adding files entries

@phrohdoh
Copy link
Author

It does have a <files> entry:

  <files>
    <file src="../mods/common/*.dll" target="lib"/>
  </files>

@yishaigalatzer
Copy link

missed it before. Can you try something very basic to verify there is no mistake in your setup? We did verify this basic scenario on mono, so I'm suspecting something else might be going on (perhaps files do not exist on disk when you run nuget.exe pack?)

@phrohdoh
Copy link
Author

<?xml version="1.0"?>
<package>
  <metadata>
    <id>LibDependOnMe</id>
    <version>1.0.0</version>
    <title>LibDependOnMe Test</title>
    <authors>Phrohdoh</authors>
    <owners>Phrohdoh</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>You can depend on this logger!</description>
    <releaseNotes>Test...</releaseNotes>
    <copyright>Copyright 2016</copyright>
    <tags>Test LibTest</tags>
  </metadata>
  <files>
    <file src="bin\Debug\*.dll" target="lib"/>
<!--    <file src="bin/Debug/*.dll" target="lib"/> also tried this -->
  </files>
</package>
tmba:LibDependOnMe thill $ test -f "bin/Debug/LibDependOnMe.dll" && nuget pack LibDependOnMe.csproj -verbosity detailed
MSBuild auto-detection: using msbuild version '4.0' from '/Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
Attempting to build package from 'LibDependOnMe.csproj'.
System.NotImplementedException: The method or operation is not implemented.
  at (wrapper dynamic-method) System.Object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object)
  at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid1[T0] (System.Runtime.CompilerServices.CallSite site, System.Dynamic.T0 arg0) <0x3f20bc8 + 0x003ee> in <filename unknown>:0
  at NuGet.CommandLine.ProjectFactory.ResolveTargetPath () <0x3f1cfc8 + 0x0094e> in <filename unknown>:0
  at NuGet.CommandLine.ProjectFactory.BuildProject () <0x3f1ca60 + 0x0044f> in <filename unknown>:0
  at NuGet.CommandLine.ProjectFactory.CreateBuilder (System.String basePath) <0x3f1c048 + 0x0004f> in <filename unknown>:0
  at NuGet.CommandLine.PackCommand.BuildFromProjectFile (System.String path) <0x372b330 + 0x0023f> in <filename unknown>:0
  at NuGet.CommandLine.PackCommand.BuildPackage (System.String path) <0x372b2b0 + 0x0005f> in <filename unknown>:0
  at NuGet.CommandLine.PackCommand.ExecuteCommand () <0x3725518 + 0x001f7> in <filename unknown>:0
  at NuGet.CommandLine.Command.ExecuteCommandAsync () <0x37254e8 + 0x00010> in <filename unknown>:0
  at NuGet.CommandLine.Command.Execute () <0x3708a80 + 0x001e4> in <filename unknown>:0
  at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) <0x6e6be8 + 0x0065c> in <filename unknown>:0
.
├── LibDependOnMe
│   ├── LibDependOnMe.csproj
│   ├── LibDependOnMe.nuspec
│   ├── Logger.cs
│   ├── Properties
│   │   └── AssemblyInfo.cs
│   ├── bin
│   │   └── Debug
│   │       ├── LibDependOnMe.dll
│   │       └── LibDependOnMe.dll.mdb
│   └── obj
│       └── Debug
│           ├── LibDependOnMe.csproj.FilesWrittenAbsolute.txt
│           ├── LibDependOnMe.dll
│           └── LibDependOnMe.dll.mdb
├── NuGetTest
│   ├── NuGetTest.csproj
│   ├── Program.cs
│   ├── Properties
│   │   └── AssemblyInfo.cs
│   ├── bin
│   │   └── Debug
│   │       ├── NuGetTest.exe
│   │       └── NuGetTest.exe.mdb
│   └── obj
│       └── x86
│           └── Debug
│               ├── NuGetTest.csproj.FilesWrittenAbsolute.txt
│               ├── NuGetTest.exe
│               └── NuGetTest.exe.mdb
├── NuGetTest.sln
└── NuGetTest.userprefs

13 directories, 19 files

@phrohdoh
Copy link
Author

I did some poking around (with this diff) and got some verbose output, but it may not be of any help.

diff --git a/src/CommandLine/Commands/PackCommand.cs b/src/CommandLine/Commands/PackCommand.cs
index dd52d98..8df2f60 100644
--- a/src/CommandLine/Commands/PackCommand.cs
+++ b/src/CommandLine/Commands/PackCommand.cs
@@ -291,6 +291,7 @@ namespace NuGet.Commands

         private IPackage BuildFromNuspec(string path)
         {
+           Console.WriteLine("BuildFromNuspec({0})", path);
             PackageBuilder packageBuilder = CreatePackageBuilderFromNuspec(path);

             if (Symbols)
diff --git a/src/CommandLine/Commands/ProjectFactory.cs b/src/CommandLine/Commands/ProjectFactory.cs
index 358e6ab..199cabc 100644
--- a/src/CommandLine/Commands/ProjectFactory.cs
+++ b/src/CommandLine/Commands/ProjectFactory.cs
@@ -52,6 +52,7 @@ namespace NuGet.Commands
         public ProjectFactory(string path, IDictionary<string, string> projectProperties)
             : this(new Project(path, projectProperties, null))
         {
+           System.Console.WriteLine("ProjectFactory({0}, ..)", path);
         }

         public ProjectFactory(Project project)
@@ -284,6 +285,7 @@ namespace NuGet.Commands

         private string ResolveTargetPath()
         {
+           System.Console.WriteLine("ProjectFactory.ResolveTargetPath()");
             // Set the project properties
             foreach (var property in ProjectProperties)
             {
@@ -294,11 +296,17 @@ namespace NuGet.Commands
                     // (which those passed in via the ctor are) as trying to set global properties
                     // with this method throws.
                     _project.SetProperty(property.Key, property.Value);
+                   System.Console.WriteLine("SetProperty({0}, {1})", property.Key, property.Value);
                 }
             }

             // Re-evaluate the project so that the new property values are applied
-            _project.ReevaluateIfNecessary();
+           //_project.ReevaluateIfNecessary();
+
+           foreach (var prop in _project.Properties)
+           {
+               System.Console.WriteLine("{0}:\n\t{1}\n\t{2}", prop.Name, prop.UnevaluatedValue, prop.EvaluatedValue);
+           }

             // Return the new target path
             return _project.GetPropertyValue("TargetPath");
@@ -793,6 +801,8 @@ namespace NuGet.Commands
         private Manifest ProcessNuspec(PackageBuilder builder, string basePath)
         {
             string nuspecFile = GetNuspec();
+           System.Console.WriteLine(builder.Id);
+           System.Console.WriteLine(nuspecFile);

             if (String.IsNullOrEmpty(nuspecFile))
             {
@@ -811,6 +821,7 @@ namespace NuGet.Commands
                 if (manifest.Files != null)
                 {
                     basePath = String.IsNullOrEmpty(basePath) ? Path.GetDirectoryName(nuspecFile) : basePath;
+                    System.Console.WriteLine("PopulateFiles({0}, {1})", basePath, string.Join (",", manifest.Files));
                     builder.PopulateFiles(basePath, manifest.Files);
                 }

diff --git a/src/Core/Authoring/PackageBuilder.cs b/src/Core/Authoring/PackageBuilder.cs
index afa5991..6ecd306 100644
--- a/src/Core/Authoring/PackageBuilder.cs
+++ b/src/Core/Authoring/PackageBuilder.cs
@@ -237,7 +237,7 @@ namespace NuGet
         public void Save(Stream stream)
         {
             // Make sure we're saving a valid package id
-            PackageIdValidator.ValidatePackageId(Id);
+           PackageIdValidator.ValidatePackageId(Id);

             // Throw if the package doesn't contain any dependencies nor content
             if (!Files.Any() && !DependencySets.SelectMany(d => d.Dependencies).Any() && !FrameworkReferences.Any())
@@ -511,6 +511,8 @@ namespace NuGet

         private void AddFiles(string basePath, string source, string destination, string exclude = null)
         {
+           System.Console.WriteLine("PackageBuilder._AddFiles({0}, {1}, {2}, {3})",
+                                    basePath, source, destination, exclude ?? "<null>");
             List<PhysicalPackageFile> searchFiles = PathResolver.ResolveSearchPattern(basePath, source, destination, _includeEmptyDirectories).ToList();
             if (_includeEmptyDirectories)
             {
diff --git a/src/VsEvents/VsEvents.csproj b/src/VsEvents/VsEvents.csproj
index ed66a66..c9bee51 100644
--- a/src/VsEvents/VsEvents.csproj
+++ b/src/VsEvents/VsEvents.csproj
@@ -44,7 +44,6 @@
     <Reference Include="System.Core" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
     <Reference Include="System.Data" />
     <Reference Include="System.Xml" />
   </ItemGroup>
tmba:OpenRA.Mods.Common thill $ md ~/projects/csharp/dotnet/nuget2/src/CommandLine/bin/Release/NuGet.exe pack OpenRA.Mods.Common.csproj -verbosity detailed
Attempting to build package from 'OpenRA.Mods.Common.csproj'.
ProjectFactory(OpenRA.Mods.Common.csproj, ..)
ProjectFactory.ResolveTargetPath()
SetProperty(SolutionDir, /Users/thill/projects/openra/)
OLDPWD:
        /Users/thill/projects/openra
        /Users/thill/projects/openra
CLICOLOR:
        1
        1
DISPLAY:
        /private/tmp/com.apple.launchd.VtOTF1RvUx/org.macosforge.xquartz:0
        /private/tmp/com.apple.launchd.VtOTF1RvUx/org.macosforge.xquartz:0
RUST_SRC_PATH:
        /Users/thill/projects/langs/rust/src/
        /Users/thill/projects/langs/rust/src/
XPC_FLAGS:
        0x0
        0x0
AUTO_SOURCE_VENV_DEACTIVATE:
        true
        true
SHLVL:
        3
        3
TERM:
        xterm-256color
        xterm-256color
LOGNAME:
        thill
        thill
__CF_USER_TEXT_ENCODING:
        0x1F5:0x0:0x0
        0x1F5:0x0:0x0
Apple_PubSub_Socket_Render:
        /private/tmp/com.apple.launchd.Gll5xukgum/Render
        /private/tmp/com.apple.launchd.Gll5xukgum/Render
LANG:
        en_US.UTF-8
        en_US.UTF-8
TMUX_PANE:
        %3
        %3
XPC_SERVICE_NAME:
        0
        0
ITERM_SESSION_ID:
        w0t0p0
        w0t0p0
USER:
        thill
        thill
ITERM_PROFILE:
        Default
        Default
EDITOR:
        vim
        vim
PATH:
        /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/thill/bin:/usr/local/sbin
        /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/thill/bin:/usr/local/sbin
PS1:
        \h:\W \u \e[0;36m$ \e[0m
        \h:\W \u \e[0;36m$ \e[0m
SSH_AUTH_SOCK:
        /private/tmp/com.apple.launchd.VI4HP1G6u7/Listeners
        /private/tmp/com.apple.launchd.VI4HP1G6u7/Listeners
TMUX_PLUGIN_MANAGER_PATH:
        /Users/thill/.tmux/plugins/
        /Users/thill/.tmux/plugins/
TMUX:
        /private/var/folders/nm/flcs9rxx14n5rv2b9kh64mlh0000gn/T/tmux-501/default,455,0
        /private/var/folders/nm/flcs9rxx14n5rv2b9kh64mlh0000gn/T/tmux-501/default,455,0
HOME:
        /Users/thill
        /Users/thill
_:
        /usr/local/bin/mono
        /usr/local/bin/mono
TERM_PROGRAM:
        iTerm.app
        iTerm.app
TMPDIR:
        /var/folders/nm/flcs9rxx14n5rv2b9kh64mlh0000gn/T/
        /var/folders/nm/flcs9rxx14n5rv2b9kh64mlh0000gn/T/
EVENT_NOKQUEUE:
        1
        1
SHELL:
        /bin/bash
        /bin/bash
LSCOLORS:
        dxfxcxdxbxegedabagacad
        dxfxcxdxbxegedabagacad
PWD:
        /Users/thill/projects/openra/OpenRA.Mods.Common
        /Users/thill/projects/openra/OpenRA.Mods.Common
MSBuildBinPath:
        /Library/Frameworks/Mono.framework/Versions/4.3.0/lib/mono/4.5
        /Library/Frameworks/Mono.framework/Versions/4.3.0/lib/mono/4.5
MSBuildProjectDefaultTargets:


MSBuildProjectDirectory:
        /Users/thill/projects/openra/OpenRA.Mods.Common/
        /Users/thill/projects/openra/OpenRA.Mods.Common/
MSBuildProjectDirectoryNoRoot:
        Users/thill/projects/openra/OpenRA.Mods.Common
        Users/thill/projects/openra/OpenRA.Mods.Common
MSBuildProjectExtension:
        .csproj
        .csproj
MSBuildProjectFile:
        OpenRA.Mods.Common.csproj
        OpenRA.Mods.Common.csproj
MSBuildProjectFullPath:
        /Users/thill/projects/openra/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
        /Users/thill/projects/openra/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
MSBuildProjectName:
        OpenRA.Mods.Common
        OpenRA.Mods.Common
MSBuildStartupDirectory:


MSBuildThisFile:
        OpenRA.Mods.Common.csproj
        OpenRA.Mods.Common.csproj
MSBuildThisFileFullPath:
        /Users/thill/projects/openra/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
        /Users/thill/projects/openra/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
MSBuildThisFileName:
        OpenRA.Mods.Common
        OpenRA.Mods.Common
MSBuildThisFileExtension:
        .csproj
        .csproj
MSBuildThisFileDirectory:
        /Users/thill/projects/openra/OpenRA.Mods.Common
        /Users/thill/projects/openra/OpenRA.Mods.Common
MSBuildThisFileDirectoryNoRoot:
        Users/thill/projects/openra/OpenRA.Mods.Common//
        Users/thill/projects/openra/OpenRA.Mods.Common//
MSBuildToolsPath:
        /Library/Frameworks/Mono.framework/Versions/4.3.0/lib/mono/4.5
        /Library/Frameworks/Mono.framework/Versions/4.3.0/lib/mono/4.5
MSBuildToolsVersion:
        4.0
        4.0
MonoUseMicrosoftBuildDll:
        True
        True
OS:
        Unix
        Unix
MSBuildExtensionsPath:
        /Library/Frameworks/Mono.framework/Versions/4.3.0/lib/mono/xbuild
        /Library/Frameworks/Mono.framework/Versions/4.3.0/lib/mono/xbuild
MSBuildExtensionsPath32:
        /Library/Frameworks/Mono.framework/Versions/4.3.0/lib/mono/xbuild
        /Library/Frameworks/Mono.framework/Versions/4.3.0/lib/mono/xbuild
MSBuildExtensionsPath64:
        /Library/Frameworks/Mono.framework/Versions/4.3.0/lib/mono/xbuild
        /Library/Frameworks/Mono.framework/Versions/4.3.0/lib/mono/xbuild
SolutionDir:
        /Users/thill/projects/openra/

NuGet.CommandLineException: Unable to find ''. Make sure the project has been built.
  at NuGet.Commands.ProjectFactory.BuildProject () [0x00153] in /Users/thill/projects/csharp/dotnet/nuget2/src/CommandLine/Commands/ProjectFactory.cs:281
  at NuGet.Commands.ProjectFactory.CreateBuilder (System.String basePath) [0x00006] in /Users/thill/projects/csharp/dotnet/nuget2/src/CommandLine/Commands/ProjectFactory.cs:127
  at NuGet.Commands.PackCommand.BuildFromProjectFile (System.String path) [0x000cc] in /Users/thill/projects/csharp/dotnet/nuget2/src/CommandLine/Commands/PackCommand.cs:384
  at NuGet.Commands.PackCommand.BuildPackage (System.String path) [0x00020] in /Users/thill/projects/csharp/dotnet/nuget2/src/CommandLine/Commands/PackCommand.cs:288
  at NuGet.Commands.PackCommand.ExecuteCommand () [0x000b4] in /Users/thill/projects/csharp/dotnet/nuget2/src/CommandLine/Commands/PackCommand.cs:133
  at NuGet.Commands.Command.Execute () [0x000db] in /Users/thill/projects/csharp/dotnet/nuget2/src/CommandLine/Commands/Command.cs:111
  at NuGet.Program.Main (System.String[] args) [0x001a2] in /Users/thill/projects/csharp/dotnet/nuget2/src/CommandLine/Program.cs:95

If I keep the ReevaluateIfNecessary() I always get:

tmba:OpenRA.Mods.Common thill $ md ~/projects/csharp/dotnet/nuget2/src/CommandLine/bin/Release/NuGet.exe pack OpenRA.Mods.Common.csproj -verbosity detailed
Attempting to build package from 'OpenRA.Mods.Common.csproj'.
ProjectFactory(OpenRA.Mods.Common.csproj, ..)
ProjectFactory.ResolveTargetPath()
SetProperty(SolutionDir, /Users/thill/projects/openra/)
System.NotImplementedException: The method or operation is not implemented.
  at NuGet.Commands.ProjectFactory.ResolveTargetPath () [0x00098] in /Users/thill/projects/csharp/dotnet/nuget2/src/CommandLine/Commands/ProjectFactory.cs:304
  at NuGet.Commands.ProjectFactory.BuildProject () [0x00137] in /Users/thill/projects/csharp/dotnet/nuget2/src/CommandLine/Commands/ProjectFactory.cs:276
  at NuGet.Commands.ProjectFactory.CreateBuilder (System.String basePath) [0x00006] in /Users/thill/projects/csharp/dotnet/nuget2/src/CommandLine/Commands/ProjectFactory.cs:127
  at NuGet.Commands.PackCommand.BuildFromProjectFile (System.String path) [0x000cc] in /Users/thill/projects/csharp/dotnet/nuget2/src/CommandLine/Commands/PackCommand.cs:384
  at NuGet.Commands.PackCommand.BuildPackage (System.String path) [0x00020] in /Users/thill/projects/csharp/dotnet/nuget2/src/CommandLine/Commands/PackCommand.cs:288
  at NuGet.Commands.PackCommand.ExecuteCommand () [0x000b4] in /Users/thill/projects/csharp/dotnet/nuget2/src/CommandLine/Commands/PackCommand.cs:133
  at NuGet.Commands.Command.Execute () [0x000db] in /Users/thill/projects/csharp/dotnet/nuget2/src/CommandLine/Commands/Command.cs:111
  at NuGet.Program.Main (System.String[] args) [0x001a2] in /Users/thill/projects/csharp/dotnet/nuget2/src/CommandLine/Program.cs:95

@phrohdoh
Copy link
Author

I think I've found part of the reason that files are not found even though the <files> entry does exist.

Do note that this is calling pack on the nuspec instead of the csproj.

tmba:OpenRA.Mods.Common thill $ nuget2 pack OpenRA.Mods.Common.nuspec
Attempting to build package from 'OpenRA.Mods.Common.nuspec'.
BuildFromNuspec(OpenRA.Mods.Common.nuspec)
CreatePackageBuilderFromNuspec -> new PackageBuilder(OpenRA.Mods.Common.nuspec, /Users/thill/projects/openra/OpenRA.Mods.Common, NuGet.Commands.PackCommand+DictionaryPropertyProvider, True)
Manifest.ReadFrom(.. 3)
ManifestReader.ReadManifest(XDocument: )
ManifestReader.ReadFilesList(XElement)
{http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd}file

PackageBuilder.AddFiles(
basePath: /Users/thill/projects/openra/OpenRA.Mods.Common
source: ../mods/common/*.dll
destination: lib
exclude: <null>
);

PathResolver.ResolveSearchPattern(
basePath: /Users/thill/projects/openra/OpenRA.Mods.Common,
searchPath: ../mods/common/*.dll,
targetPath: lib,
includeEmptyDirectories: True
);

PathResolver.PerformWildcardSearchInternal(
basePath: /Users/thill/projects/openra/OpenRA.Mods.Common,
searchPath: ../mods/common/*.dll,
includeEmptyDirectories: True
);

basePath='/Users/thill/projects/openra'
PathResolver.GetPathToEnumerateFrom(
basePath: /Users/thill/projects/openra,
searchPath: /mods/common/*.dll
);

wildcardIndex=13
nonWildcardPortion='mods/common'
basePath='/Users/thill/projects/openra'
basePathToEnumerate='/Users/thill/projects/openra/mods/common'
normalizedBasePath='/Users/thill/projects/openra/mods/common'
searchOption=TopDirectoryOnly
searchRegex=^/mods/common/[^/]*(/)?\.dll$
file='/Users/thill/projects/openra/mods/common/FreeSans.ttf', IsMatch=False
file='/Users/thill/projects/openra/mods/common/FreeSansBold.ttf', IsMatch=False
file='/Users/thill/projects/openra/mods/common/OpenRA.Mods.Common.dll', IsMatch=False
file='/Users/thill/projects/openra/mods/common/OpenRA.Mods.Common.dll.mdb', IsMatch=False
Cannot create a package that has no dependencies nor content.

The interesting bits are:

normalizedBasePath='/Users/thill/projects/openra/mods/common'
searchOption=TopDirectoryOnly
searchRegex=^/mods/common/[^/]*(/)?\.dll$

This is searching in ~/projects/openra/mods/common for ^/mods/common/*.dll$ which of course won't exist.

I'm not sure how to modify this line into what I am after:
Regex searchRegex = WildcardToRegex(Path.Combine(basePath, searchPath));

@phrohdoh
Copy link
Author

After a bit more investigation I've discovered that searchPath is causing the issue noted above because it starts with / which is my Path.DirectorySeparatorChar meaning Path.Combine simply returns searchPath without doing any actual concatenation.

I have a (heavily butchered) git state for NuGet/NuGet2 that I can push if anyone thinks I am down the right path for submitting a fix.

@yishaigalatzer
Copy link

Cool, push a pr mark it for feedback only in the comments and add a failing test

@endel
Copy link

endel commented Feb 19, 2016

I'm having the same problem here, guys. I'm also using OSX.

NuGet Version: 2.8.5.0
Mono 4.2.2

Here's the output of nuget pack using -verbosity detailed.

$ nuget pack Colyseus.csproj -verbosity detailed
Attempting to build package from 'Colyseus.csproj'.
System.NotImplementedException: The method or operation is not implemented.
  at NuGet.Commands.ProjectFactory.ResolveTargetPath () <0x2e00f50 + 0x0010f> in <filename unknown>:0
  at NuGet.Commands.ProjectFactory.BuildProject () <0x2e009d0 + 0x0042b> in <filename unknown>:0
  at NuGet.Commands.ProjectFactory.CreateBuilder (System.String basePath) <0x2e00000 + 0x0004f> in <filename unknown>:0
  at NuGet.Commands.PackCommand.BuildFromProjectFile (System.String path) <0x2cdfe80 + 0x00227> in <filename unknown>:0
  at NuGet.Commands.PackCommand.BuildPackage (System.String path) <0x2cdfe00 + 0x0005f> in <filename unknown>:0
  at NuGet.Commands.PackCommand.ExecuteCommand () <0x2cdf528 + 0x0019f> in <filename unknown>:0
  at NuGet.Commands.Command.Execute () <0x2cc3918 + 0x00286> in <filename unknown>:0
  at NuGet.Program.Main (System.String[] args) <0x66c928 + 0x004ce> in <filename unknown>:0

@yishaigalatzer
Copy link

@endel 2.8.5 is no longer supported. We are currently porting pack to work on .net core so it can work safely on .net core (which will work on Mac natively).

I would start by updating to NuGet 3.3, and use pack with nuspec, pack with csproj is not supported at this point, and will be enabled in a future release.

@endel
Copy link

endel commented Feb 19, 2016

I see, thanks @yishaigalatzer. For some reason version 2.8.5 were installed by default with mono or something. With v3.3 it works fine!

@yishaigalatzer
Copy link

Great to hear! Much appreciated taking the time to update us.

@harikmenon harikmenon modified the milestone: Client-VNext Apr 19, 2016
@amedee
Copy link

amedee commented Jun 23, 2016

I can confirm that this also occurs with:

  • NuGet 3.4.4.1321
  • Mono JIT compiler version 4.2.1 (Debian 4.2.1.102+dfsg2-7ubuntu4)

Will now attempt to write a nuspec file from scratch. Unfortunately there's no fancy NuGet Package Explorer for me. :(

@zhili1208 zhili1208 added Resolution:Duplicate This issue appears to be a Duplicate of another issue and removed help wanted Considered good issues for community contributions. labels Sep 28, 2016
@sbrl
Copy link

sbrl commented Sep 29, 2016

Ummm why was this closed, @zhili1208? MSBuild AFAIK doesn't run on linux, only windows, so I don't get how #3550 is related. I'm probably missing something here. Unless the issue I'm seeing is a completely different one (probable), in which case I'll file a separate bug..

@yishaigalatzer
Copy link

Msbuild now runs on Linux

Sent from Ninehttp://www.9folders.com/


From: Starbeamrainbowlabs notifications@github.com
Sent: Sep 28, 2016 10:44 PM
To: NuGet/Home
Cc: Yishai Galatzer; Mention
Subject: Re: [NuGet/Home] NuGet pack fails with 'The method or operation is not implemented.' (#1946)

Ummm why was this closed, @zhili1208https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fzhili1208&data=01%7C01%7Cyigalatz%40microsoft.com%7Cfc81267131ca4202adb708d3e82bb1af%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=ferwWiqlRDW3PDiuYAjCaru0VQVARdqJ2oc4Er1I54g%3D&reserved=0? MSBuild AFAIK doesn't run on linux, only windows, so I don't get how #3550https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNuGet%2FHome%2Fissues%2F3550&data=01%7C01%7Cyigalatz%40microsoft.com%7Cfc81267131ca4202adb708d3e82bb1af%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=zaS7Q42mB%2B76rTLrvHwJZpfIH1VoF0sbl7VDioxQwPk%3D&reserved=0 is related. I'm probably missing something here. Unless the issue I'm seeing is a completely different one (probable), in which case I'll file a separate bug..

You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNuGet%2FHome%2Fissues%2F1946%23issuecomment-250375455&data=01%7C01%7Cyigalatz%40microsoft.com%7Cfc81267131ca4202adb708d3e82bb1af%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=WoCK5FabaGCZAcg4QSvt0ItnGHhg0dLcDsX%2FSBtsif0%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABLmtwUgeI2mvT2ICW6nZwoXGyrzVC-zks5qu1BBgaJpZM4HHX7F&data=01%7C01%7Cyigalatz%40microsoft.com%7Cfc81267131ca4202adb708d3e82bb1af%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=95OKDwnEm10jwWnojJkKaSBtU%2Fq0mlYXkKMjAQISrTI%3D&reserved=0.

@phrohdoh
Copy link
Author

MSBuild runs on *nix, but I don't think this is resolved until msbuild is either required or shipped, or xbuild is picked up correctly.

@yishaigalatzer
Copy link

True but it is covered by fixing 3550

@sbrl
Copy link

sbrl commented Sep 29, 2016

It does? I had no idea. Huh. Why can't nuget use xbuild though?

And how do I install the linux version of msbuild?

@zhili1208
Copy link
Contributor

@sbrl nuget can use xbuild, but it still won't work due to xbuild bug. Mono will install msbuild for you, so you don't need to install that, but for now mono only do that for mac. not sure when they will do that on linux

@sbrl
Copy link

sbrl commented Sep 30, 2016

Hrm. So I just have to wait until it works then?

@Pandurangv
Copy link

this link shows data providers registered with visual studio in registry

http://blog.nwoolls.com/2012/07/25/registering-missing-data-providers-with-visual-studio-2012/

best luck

@sbrl
Copy link

sbrl commented Nov 18, 2016

Ummm I don't understand those links, @Pandurangv. I can't see how they're related to my nuget packaging error, but I'm probably just misunderstanding something.

@yishaigalatzer
Copy link

CC @kzu @mrward @mhutch on timing

@mikob
Copy link

mikob commented May 25, 2017

On *nix, ran sudo nuget update -self and I could create a nuget package from the nuspec file successfully.

@qguv
Copy link

qguv commented Jun 20, 2017

@zhili1208 The resolution to #3550 doesn't fix the issue for me either. On macOS, it's still not possible to build a nuget package from a .csproj.

@kzu
Copy link

kzu commented Jun 20, 2017

@qguv maybe you could try NuGetizer instead and see if that fixes it? install-package NuGet.Build.Packaging ;)

@qguv
Copy link

qguv commented Jun 20, 2017

I ended up writing a .nuspec file from scratch.

I'd really like to see support for building from a .csproj file on macOS as that is the method the official tutorials use when walking through the packaging process. Alternatively, the tutorials could be changed to use a different method.

@phrohdoh
Copy link
Author

You can install PowerShell via homebrew: brew install powershell

Of course NuGet proper should support what it promises to support but I haven't seen that yet.

@kzu
Copy link

kzu commented Jun 21, 2017

@qguv NuGetizer is supported on macOS.

@JoseFMP
Copy link

JoseFMP commented Jul 7, 2017

This issue still has no solution?! Means if you want to pack a nuget package in linux you are damn forced to use nuspec files?! That's ok, but it has more terrible implications: you are forced to use the old csproj format, and you can therefore not use .NET Core.

Any plans to work on this? msbuild for linux is out since a while ago an working fine. It should not be too hard any more to make nuget pack work on linux.

@sbrl
Copy link

sbrl commented Jul 7, 2017

@jose-cf Ummm what? You don't use .csproj files in .NET core? I have more reading to do than I thought......

@JoseFMP
Copy link

JoseFMP commented Jul 11, 2017

@sbrl I use cspoj files to define my .NET projects. What do you mean?

@kzu
Copy link

kzu commented Jul 11, 2017

you are forced to use the old csproj format

you mean forced to use the NEW csproj format ;), which totally rocks!

@sbrl
Copy link

sbrl commented Jul 11, 2017

@jose-cf I'm just confused. What's changed? Does anyone have a good article they can recommend to me to bring my knowledge up-to-date?

@JoseFMP
Copy link

JoseFMP commented Jul 13, 2017

@kzu no... that is the problem... forced to use the old! And therefore cannot target netcoreapp1.x or netcoreapp2.x.

Please fix!!

@kzu
Copy link

kzu commented Jul 14, 2017

@jose-cf this combination works, we're using it: new csproj (15.3+) plus nugetizer. Can target netcoreapp, any version, and netstandard too.

@ArtOfSettling
Copy link

For anyone still interested in this, I solved my use case (see bug 5627) with the following argument.

-MsbuildPath /usr/lib/mono/msbuild/15.0/bin/

;)

This forced nuget to use the version of msbuild bundled with mono instead of the xbuild.

@delphyne
Copy link

to anyone who finds this issue while trying to use Cakebuild...

var settings = new NuGetPackSettings
{
    settings.ArgumentCustomization = args => args.Append("-MSBuildPath /usr/lib/mono/msbuild/15.0/bin/");
};
NuGetPack(project.Path, settings);

...will get you past the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Pack Platform:Mono NuGet.exe on mono scenarios Resolution:Duplicate This issue appears to be a Duplicate of another issue Type:Feature
Projects
None yet
Development

No branches or pull requests