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

Support for nuget packing of project files #637

Closed
daveaglick opened this issue Jan 14, 2016 · 25 comments
Closed

Support for nuget packing of project files #637

daveaglick opened this issue Jan 14, 2016 · 25 comments
Milestone

Comments

@daveaglick
Copy link
Member

NuGet supports a mode where you can tell it to pack a project file and it will automatically resolve references, binaries, etc. and pull values from a corresponding .nuspec sitting alongside the project file. The NuGet packing support in Cake doesn't appear to support this use case.

NuGetPack(...) attempts to read and parse the passed-in argument as a .nuspec file so that it can transform it before calling nuget pack .... This step should be avoided when packing a project file and we should probably go straight to the NuGetPacker.

I don't mind taking a look - what would be the best way to indicate this alternate behavior? Create a new alias like NuGetPackProject(...), check the extension of the file passed to NuGetPack(..), or rely on some value in the NuGetPackSettings?

@ErikSchierboom
Copy link
Contributor

IMHO, I think that the NuGetPack method should check the extension of the file and then decide if it is a .nuspec or .csproj/.vbproj file (do .fsproj files also work?). This makes sense to me as the actual nuget pack call the same for .nuspec and .csproj files, only the files are different.

The NuGetPack method should then call a NuGetPackNuspec method or NuGetPackProject method, which should also be able to called directly. What do you think?

@asbjornu
Copy link
Contributor

@ErikSchierboom Sounds like a good strategy. I've just hit the issue and would love to do NuGetPack() of .csproj files. :)

@ErikSchierboom
Copy link
Contributor

I will be working on also allowing you to use file globbing patterns with the NuGet functions :)

@daveaglick
Copy link
Member Author

@ErikSchierboom 👍 - so are you going to take a look at this? No problem if so, just want to make sure I'm not duplicating effort.

@ErikSchierboom
Copy link
Contributor

@daveaglick Not necessarily, you can do it, you were first :) However, maybe it is wise to wait for my updated globbing code, as it adds quite some methods. I expect to submit that in a couple of days, perhaps even later today.

@daveaglick
Copy link
Member Author

Sounds good! I'm sure I won't be as efficient (you've been on fire recently!), but I've been looking for an excuse to get my hands dirty :)

@ErikSchierboom
Copy link
Contributor

@daveaglick I've submitted a PR to extend the aliases: #662

@daveaglick
Copy link
Member Author

Awesome - I'll start working on top of the PR branch to make the merge easier once it's pulled in.

@ErikSchierboom
Copy link
Contributor

@daveaglick Great. I might have to change a thing or two I think, but that would probably make it a lot easier.

@ErikSchierboom
Copy link
Contributor

@daveaglick I had some feedback on my PR, so the PR has been updated. You might want to rebase off the updated PR.

@ristaloff
Copy link

Did you test this on mono? As I can see it uses the nuget.exe pack function, and this function is not yet supported in mono.

@daveaglick
Copy link
Member Author

@ristaloff I don't think there's any way around that right now. The NuGetPack alias that was already in Cake calls nuget.exe, and this just piggybacks off of that.

@ristaloff
Copy link

@daveaglick A possibility is to remove the dependency on nuget.exe and implement the functions. But that sounds like a lot of work. The guys working on Paket have done this. But the problem with Paket is that they package the nuget file with a newer zip format than nuget can handle, so that doesn't work for me either. (the wrong zip format only happens when creating the nuget package with paket on mono)
https://github.com/fsprojects/Paket

@patriksvensson
Copy link
Member

@ristaloff The tools are just a thin wrapper around an executable. It's up to the user to know the limitations of the tool being used.

@devlead
Copy link
Member

devlead commented Jan 28, 2016

@ristaloff just double check running latest version of nuget?
nuget.exe - latest (v3.3.0)

It's first with v3 they're starting the XPlat stuff.

@ristaloff
Copy link

@devlead Didn't work. Nuget pack command uses classes from Microsoft.Build.Evaluation namespace.
These classes has not been fully implemented in mono yet.
https://msdn.microsoft.com/en-us/library/microsoft.build.evaluation.project.reevaluateifnecessary.aspx

Btw, the nuget pack works on .nuspec files, but not on .csproj files.

So seems like I'm stuck again. Just wanted my linux buildserver to build nuget packages, without having to maintain the .nuspec files.

@devlead
Copy link
Member

devlead commented Jan 28, 2016

@ristaloff but you don't need a nuspec with Cake if you use the overload with only settings and specify all required properties on that.

@devlead
Copy link
Member

devlead commented Jan 28, 2016

You could use the built in project file parser to extract some meta data to populate the nuget pack settings
http://cakebuild.net/api/cake.common.solution.project/65286dc8/25578715

@ristaloff
Copy link

@devlead Ok, I'll look into that. Thanks.

@patriksvensson
Copy link
Member

Merged via #667.

@Philo
Copy link
Contributor

Philo commented Feb 11, 2016

@patriksvensson, just wanted to check when this change is expected to be released, I see milestone 0.9.0 is due 22nd Feb, will you be sticking to these dates?

I ask as this feature, along with the ability to specify properties for the nuget alias are absolutely key for me as I try to migrate to Cake from our existing build system.

@gep13
Copy link
Member

gep13 commented Feb 11, 2016

@Philo while we are going to "try" to hit that date, understand that it is a somewhat arbitrary date. The important thing is that all items that are marked as being part of that milestone are completed.

In the meantime, you have the option of using the build of Cake from our MyGet feed, which will include this new functionality. That will allow you to get a head start on using it, and making sure that it does what you need, and then you can switch to the official release, when it ships.

@Philo
Copy link
Contributor

Philo commented Feb 11, 2016

@gep13, do you have a link to your myget feed?

@gep13
Copy link
Member

gep13 commented Feb 11, 2016

@Philo sorry, should have included that before. The feed is here: https://www.myget.org/F/cake

@gep13
Copy link
Member

gep13 commented Jul 22, 2016

Duplicate of #551

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants