Albacore / albacore

Albacore is a professional quality suite of Rake tasks for building .NET or Mono based systems.
www.albacorebuild.net
221 stars 64 forks source link

[nugets_pack] Metadata is overwritten with project data #246

Closed iainnicol closed 5 years ago

iainnicol commented 5 years ago

These lines cause metadata to be overwritten with data from the project file:

https://github.com/Albacore/albacore/blob/6f8dab6d65f441fd155fb59666416c0813fcd076/lib/albacore/nuget_model.rb#L483-L486

This is causing problems with my attempt to port DotNetZip to Albacore v3. The various NuGet packages should have different IDs, but I think the highlighted lines cause every package to have the same IDs, etc.

I presume Albacore should additionally check whether the package.metadata.foo fields are set. I realise that's an absolutely trivial change to make, but I barely know Ruby, so I don't know the idiomatic way to write it.

haf commented 5 years ago

You can remove the Id element from the project to avoid this behaviour.

iainnicol commented 5 years ago

Thanks, but I'm not sure how to do that.

I think the block I pass to nuget_packs is given a config to modify. The nugets_pack task, and not me, instantiates both the project and the package: https://github.com/Albacore/albacore/blob/6f8dab6d65f441fd155fb59666416c0813fcd076/lib/albacore/task_types/nugets_pack.rb#L113-L117

haf commented 5 years ago

No, I mean the csproj project file. It has an Id element in its XML that you can remove, IMO.

iainnicol commented 5 years ago

Unfortunately I don't think removing Id from the csproj is sufficient. If the Id XML element is removed, I think the Albacore Project class defaults to returning the project file's basename.

https://github.com/Albacore/albacore/blob/e50512c7c8dab1bace4595669b2d2887efb7e4d2/lib/albacore/project.rb#L107-L117

iainnicol commented 5 years ago

That said, I just realised I could add the Id to the csproj.