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

pack - Pass arbitrary properties like nuget pack #1313

Closed
heaths opened this issue May 27, 2017 · 19 comments
Closed

pack - Pass arbitrary properties like nuget pack #1313

heaths opened this issue May 27, 2017 · 19 comments

Comments

@heaths
Copy link
Contributor

heaths commented May 27, 2017

What You Are Seeing?

Unlike nuget pack, I cannot pass properties to choco pack which blocks implementation of microsoft/vswhere#30.

What is Expected?

I can pass --properties "foo=1;bar=baz;" to choco pack (using the same syntax as nuget pack for uniformity). I want to be able to build packages in either configuration for 1) testing, and 2) to make sure no one who might have rearranged content broke package build. Only our release configuration would be published, but we want to build both flavors in case devs only build one (typically debug).

@ferventcoder
Copy link
Member

ferventcoder commented May 27, 2017

Hi @heaths - this is not NuGet, so expect differences. That said, let's switch this from a bug report to an enhancement request and get it on the priority list. Note: this issue may already exist.

@ferventcoder ferventcoder added this to the 0.10.8 milestone May 27, 2017
@ferventcoder ferventcoder changed the title Cannot pass properties to choco pack like nuget pack pack - pass abitrary properties like nuget pack May 27, 2017
@ferventcoder
Copy link
Member

All set up as an enhancement now - and it is open for community contribution as well. :)

@heaths
Copy link
Contributor Author

heaths commented May 27, 2017

Thanks. I'm actually taking a look at implementing it now. Just wanted to get a bug open. After fixing it, could you guys push a new version soon - especially to nuget.org? (Seems you publish https://nuget.org/packages/chocolatey, if I'm not mistaken.) I can add it to my .nuget\packages.config and have it pulled down with nuget restore for easy build-time acquisition.

@heaths
Copy link
Contributor Author

heaths commented May 27, 2017

Also, I checked before I opened (far from my first rodeo!) and couldn't find any current issue or PR similar.

@ferventcoder
Copy link
Member

This may require NuGet 3.5+, which means this will be blocked by #508 - that will be a significant undertaking and is not open for community due to how much affect it will have on core choco - much testing, much rework to redo all enhancements we've made to nuget itself in all of the new places of NuGet v3+.

@heaths
Copy link
Contributor Author

heaths commented May 27, 2017

Not sure I understand the relationship. There is a package published at https://www.nuget.org/packages/chocolatey/ that has no dependencies - just basically a raw OPC container that contains your binaries. With that I can simply run nuget restore to pull it down and extract it (which I already do for a number of other packages).

heaths added a commit to heaths/choco that referenced this issue May 27, 2017
Passes properties through to the nuget pack command to replace variables
in the nuspec file.
@ferventcoder ferventcoder self-assigned this May 27, 2017
@ferventcoder
Copy link
Member

I was talking about arbitrary properties going into nuspec - if it is for fields that already exist in nuspec, you can ignore what I was talking about.

@ferventcoder
Copy link
Member

Sorry for confusion - hard to copy parts I'm referencing when not at a computer

@heaths
Copy link
Contributor Author

heaths commented May 28, 2017

This works since you basically cloned their nuspec OM (it seems - I didn't dig too deep) to add properties like WikiUrl, ProjectUrl, etc. I've also been keeping an eye on related issues regarding them persisting arbitrary properties as a bag (like many XML and JSON parsers will do for round-tripping) but figured that would take them longer than just adding supported I needed to choco to build my packages. Hopefully they do it as some point.

But, yeah, this uses existing features in nuget to pass properties as if you specified nuget pack -properties "foo=1;bar=baz" (as you probably saw in the PR). I'm more or less just passing values through (though I need to parse them in order to pass them as a dictionary to nuget).

@ferventcoder
Copy link
Member

But, yeah, this uses existing features in nuget to pass properties as if you specified nuget pack -properties "foo=1;bar=baz" (as you probably saw in the PR). I'm more or less just passing values through (though I need to parse them in order to pass them as a dictionary to nuget).

As long as the properties translate to existing nuspec fields, I think you are fine. However if you are storing arbitrary properties, that is not supported in choco's implementation of NuGet.core:

@ferventcoder
Copy link
Member

storing arbitrary properties

And now I see why there is confusion. The properties element never made it into NuGet 3+ - https://github.com/NuGet/NuGet.Client/blob/870340673ba75a95407ab55ce1f46f57fe9bf25b/src/NuGet.Core/NuGet.Packaging/compiler/resources/nuspec.xsd (current dev branch)

I'm lost as to why that might be since the issues were closed as fixed for NuGet v3.0. Ideas @jeffhandley?

@ferventcoder ferventcoder changed the title pack - pass abitrary properties like nuget pack pack - pass arbitrary properties like nuget pack May 28, 2017
@jeffhandley
Copy link

I'm no longer working on NuGet and I don't know.

@heaths
Copy link
Contributor Author

heaths commented May 29, 2017

No, not storing arbitrary properties. This is to replace $variable$s within the nuspec file. Nothing more. That's been supported by nuget since at least mid-v2s. I've already tested my existing code changes and it works fine. No need to update NuGet.Core for this.

heaths added a commit to microsoft/vswhere that referenced this issue May 29, 2017
NuProj is not supported in Visual Studio 2017 nor will it probably ever be according to its creator/maintainer.

Waiting on chocolatey/choco#1313 to be able to use that and uncomment Chocolatey-specific fields.
heaths added a commit to microsoft/vswhere that referenced this issue May 29, 2017
NuProj is not supported in Visual Studio 2017 nor will it probably ever be according to its creator/maintainer.

Waiting on chocolatey/choco#1313 to be able to use that and uncomment Chocolatey-specific fields.
heaths added a commit to microsoft/vswhere that referenced this issue May 29, 2017
NuProj is not supported in Visual Studio 2017 nor will it probably ever be according to its creator/maintainer.

Waiting on chocolatey/choco#1313 to be able to use that and uncomment Chocolatey-specific fields.
heaths added a commit to microsoft/vswhere that referenced this issue May 29, 2017
NuProj is not supported in Visual Studio 2017 nor will it probably ever be according to its creator/maintainer.

Waiting on chocolatey/choco#1313 to be able to use that and uncomment Chocolatey-specific fields.
heaths added a commit to microsoft/vswhere that referenced this issue May 29, 2017
NuProj is not supported in Visual Studio 2017 nor will it probably ever be according to its creator/maintainer.

Waiting on chocolatey/choco#1313 to be able to use that and uncomment Chocolatey-specific fields.
heaths added a commit to microsoft/vswhere that referenced this issue May 29, 2017
NuProj is not supported in Visual Studio 2017 nor will it probably ever be according to its creator/maintainer.

Waiting on chocolatey/choco#1313 to be able to use that and uncomment Chocolatey-specific fields.
heaths added a commit to microsoft/vswhere that referenced this issue May 29, 2017
NuProj is not supported in Visual Studio 2017 nor will it probably ever be according to its creator/maintainer.

Waiting on chocolatey/choco#1313 to be able to use that and uncomment Chocolatey-specific fields.
@heaths
Copy link
Contributor Author

heaths commented May 29, 2017

Sorry for all the comments. I'll remove the issue reference. Don't want to rack up a bunch of commits just trying to get appveyor to work.

heaths added a commit to heaths/choco that referenced this issue Jun 1, 2017
@ferventcoder ferventcoder modified the milestones: 0.10.8, 0.10.9 Jun 6, 2017
@ferventcoder ferventcoder modified the milestones: 0.10.8, 0.10.9 Jul 5, 2017
heaths added a commit to heaths/choco that referenced this issue Jul 6, 2017
Passes properties through to the nuget pack command to replace variables
in the nuspec file.
@ccamburn
Copy link

+1 for this. One of the nice things about nuspec files when we create nuget packages are that we can use variables for things like path to the bin folder (using $configuration$\bin) or custom id's or descriptions on packages. We often need to create multiple packages in our process, either to have ci packages, internal vs. external, packages built in debug vs. release, etc. Having a single nuspec that we can pass params into makes life much easier, instead of having different nuspecs for each.

@ferventcoder
Copy link
Member

This is slated for vNext 👍

ferventcoder pushed a commit that referenced this issue Aug 6, 2017
Pass properties through to the nuget pack command to replace variables
in the nuspec file.
ferventcoder added a commit that referenced this issue Aug 6, 2017
* pr1314:
  (GH-1313) pack - allow passing arbitrary properties
ferventcoder added a commit that referenced this issue Aug 6, 2017
* stable:
  (GH-1313) pack - allow passing arbitrary properties
@ferventcoder
Copy link
Member

This is now in the codebase, but we don't yet have an ETA on 0.10.8. It could be pretty soon (sometime in August).

@ferventcoder
Copy link
Member

@heaths thanks again for helping to get this in, glad it turned out to be quite easy!

@ferventcoder
Copy link
Member

Just a note that I just pushed up a beta version with this included. https://chocolatey.org/packages/chocolatey/0.10.8-beta-20170806

@ferventcoder ferventcoder changed the title pack - pass arbitrary properties like nuget pack pack - Pass arbitrary properties like nuget pack Aug 29, 2017
heaths added a commit to microsoft/vswhere that referenced this issue Sep 4, 2017
Now that the change for chocolatey/choco#1313 has been released in
version 0.10.8 use "choco pack" to add custom metadata for
chocolatey.org.
heaths added a commit to microsoft/vswhere that referenced this issue Sep 6, 2017
Now that the change for chocolatey/choco#1313 has been released in
version 0.10.8 use "choco pack" to add custom metadata for
chocolatey.org.
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

5 participants