{"action":"created","issue":{"url":"https://api.github.com/repos/cake-build/cake/issues/706","repository_url":"https://api.github.com/repos/cake-build/cake","labels_url":"https://api.github.com/repos/cake-build/cake/issues/706/labels{/name}","comments_url":"https://api.github.com/repos/cake-build/cake/issues/706/comments","events_url":"https://api.github.com/repos/cake-build/cake/issues/706/events","html_url":"https://github.com/cake-build/cake/issues/706","id":135989196,"number":706,"title":"Nuget push is broken on mono","user":{"login":"andycmaj","id":97470,"avatar_url":"https://avatars.githubusercontent.com/u/97470?v=3","gravatar_id":"","url":"https://api.github.com/users/andycmaj","html_url":"https://github.com/andycmaj","followers_url":"https://api.github.com/users/andycmaj/followers","following_url":"https://api.github.com/users/andycmaj/following{/other_user}","gists_url":"https://api.github.com/users/andycmaj/gists{/gist_id}","starred_url":"https://api.github.com/users/andycmaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andycmaj/subscriptions","organizations_url":"https://api.github.com/users/andycmaj/orgs","repos_url":"https://api.github.com/users/andycmaj/repos","events_url":"https://api.github.com/users/andycmaj/events{/privacy}","received_events_url":"https://api.github.com/users/andycmaj/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-24T08:10:52Z","updated_at":"2016-02-26T09:41:00Z","closed_at":"2016-02-26T09:41:00Z","body":"## Symptom\r\n\r\n`NuGetPush` fails when trying to publish packages on mono.\r\n\r\n### Cake Task\r\n```csharp\r\nTask(\"Publish\")\r\n    .Does(() =>\r\n{\r\n    Information($\"WorkingDir: {Context.Environment.WorkingDirectory}\");\r\n    foreach (var packageFile in GetFiles(OutputPath + \"**/*.nupkg\"))\r\n    {\r\n        Information($\"FullPath: {packageFile.FullPath}\");\r\n        NuGetPush(p, settings);\r\n    }\r\n});\r\n```\r\n\r\n### Result\r\n\r\n```bash\r\n========================================\r\nPublish\r\n========================================\r\nExecuting task: Publish\r\nWorkingDir: /Workspaces/appature/git/ImsHealth.Automation\r\nFullPath: /Workspaces/appature/git/ImsHealth.Automation/.artifacts/Debug/ImsHealth.Automation.1.1.2.nupkg\r\nDirectory '/Workspaces/appature/git/ImsHealth.Automation/Workspaces/appature/git/ImsHealth.Automation/.artifacts/Debug' not found.\r\nAn error occured when executing task 'Publish'.\r\nError: NuGet: Process returned an error (exit code 1).\r\n```\r\n\r\n## Cause\r\n\r\n[NuGetPusher.GetArguments](https://github.com/cake-build/cake/blob/develop/src/Cake.Common/Tools/NuGet/Push/NuGetPusher.cs#L55) currently generates an absolute path to the `.nupkg` file to be pushed.\r\n\r\n```csharp\r\n55:            builder.AppendQuoted(packageFilePath.MakeAbsolute(_environment).FullPath);\r\n```\r\n\r\nApparently, this is a problem when running nuget on mono (tested with both 2.8.5 and 3.X.X).\r\n\r\n### Running Nuget With Absolute Package Path\r\n\r\n```bash\r\n$ mono .tools/nuget.exe push \"/Workspaces/appature/git/ImsHealth.Automation/.artifacts/Debug/ImsHealth.Automation.1.1.2.nupkg\"\r\nDirectory '/Workspaces/appature/git/ImsHealth.Automation/Workspaces/appature/git/ImsHealth.Automation/.artifacts/Debug' not found.\r\n```\r\n\r\nNotice how it tries to append the absolute path it's given to the current working directory:\r\n\r\n> '**/Workspaces/appature/git/ImsHealth.Automation/**Workspaces/appature/git/ImsHealth.Automation/.artifacts/Debug' not found.\r\n\r\n### Running Nuget With Relative Package Path\r\n\r\n```bash\r\n$ mono .tools/nuget.exe push \"./.artifacts/Debug/ImsHealth.Automation.1.1.2.nupkg\"\r\nPushing ImsHealth.Automation 1.1.2 to the NuGet gallery (https://www.nuget.org)...\r\n```\r\n\r\nGreat success!\r\n\r\n## Suggestion\r\n\r\n### File a bug in Nuget\r\n\r\nI did this: https://github.com/NuGet/Home/issues/2167\r\n\r\n### Workaround in Cake\r\n\r\nFumbling around in `NuGetPusher.cs` trying to figure out how to pass a relative path when on Unix.\r\nThis isn't really working, so i'm hoping someone has suggestions about how to work around this.\r\n\r\n```csharp\r\n            FilePath envSpecificPackageFilePath;\r\n            if (_environment.IsUnix())\r\n            {\r\n                // BUG: Nuget on mono doesn't work with absolute file paths.\r\n                envSpecificPackageFilePath =\r\n                    packageFilePath.GetRelativePath(_environment.WorkingDirectory).GetFilePath(packageFilePath);\r\n            }\r\n            else\r\n            {\r\n                envSpecificPackageFilePath = packageFilePath.MakeAbsolute(_environment);\r\n            }\r\n\r\n            builder.AppendQuoted(envSpecificPackageFilePath.FullPath);\r\n```"},"comment":{"url":"https://api.github.com/repos/cake-build/cake/issues/comments/189192120","html_url":"https://github.com/cake-build/cake/issues/706#issuecomment-189192120","issue_url":"https://api.github.com/repos/cake-build/cake/issues/706","id":189192120,"user":{"login":"andycmaj","id":97470,"avatar_url":"https://avatars.githubusercontent.com/u/97470?v=3","gravatar_id":"","url":"https://api.github.com/users/andycmaj","html_url":"https://github.com/andycmaj","followers_url":"https://api.github.com/users/andycmaj/followers","following_url":"https://api.github.com/users/andycmaj/following{/other_user}","gists_url":"https://api.github.com/users/andycmaj/gists{/gist_id}","starred_url":"https://api.github.com/users/andycmaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andycmaj/subscriptions","organizations_url":"https://api.github.com/users/andycmaj/orgs","repos_url":"https://api.github.com/users/andycmaj/repos","events_url":"https://api.github.com/users/andycmaj/events{/privacy}","received_events_url":"https://api.github.com/users/andycmaj/received_events","type":"User","site_admin":false},"created_at":"2016-02-26T09:41:00Z","updated_at":"2016-02-26T09:41:00Z","body":"no problem... actually the response i got on the nuget bug was, \"use nuget.exe 3.4 from the CI feed\".\r\nso i did that, and it works.\r\n\r\nthe next problem i ran into was that 3.4 tries to automatically push your .sybmols.nupkg along with a push of a normal package, and this seems to fail... so still following up on https://github.com/NuGet/Home/issues/2167. i'll close this one and feel free to follow that issue"}}