Replies: 2 comments 13 replies
-
Thanks for taking the time to write this! I'll try to address the issues.
Having used nugetizer to pack extremely non-trivial projects I can tell you there is no way the built-in SDK pack will ever accomodate advanced packing scenarios without requiring serious investment in understanding deeply what you want to pack, how to do it and with significant flexibility in the underlying targets/tasks. So, the "complain about wanting SDK Pack to just work" is wishful thinking. I've stopped using it for any serious packaging needs. Now, for the happy-path and really simple library, it's great and I do use it some times (i.e. for dotnet tools, it's great!). As I mentioned on the nuget issue: it was productive if you learned more about MSBuild 👍 . |
Beta Was this translation helpful? Give feedback.
-
Hi. I am new to Nugetize. I found it today and have spent the last several hours trying to get my head around how I am supposed to use it. I feel you really need to have a "Getting Started" guide. Your explanation on what is happening under the covers is interesting, but completely useless to get someone started. For example, You discuss adding the dotnet-nugetize tool and what that provides. , however no where in that whole discussion was it even mentioned that you need to add nugetize as a package to your projects in order to get it to work. If it wasn't for this discussion and a couple of issues where there is a discussion on GetPackageContents, I would never have been able to figure this out. -marc |
Beta Was this translation helpful? Give feedback.
-
I come in ☮️ , but have some constructive criticism that may feel like ❤️ 🗡️ . It's more that I am laying out my initial experiences with Nugetizer, and hoping that this might educate on where the documentation is lacking for someone with my background.
@kzu has mentioned I should give Nugetizer a try several times in an NuGet issue NuGet/Home#3891 that expresses some of my pain points with using SDK Pack. He wrote a blog post, NuGetizer as an alternative to .NET SDK Pack, that is thus far probably the best explanation of what NuGetizer can do. I tried to cobble together information from the official nugetizer readme.md and @kzu's blog post.
Here are some observations.
It is really hard to Google search to learn about nugetizer. I have tried several different searches and I get almost nothing interesting.
I also don't understand why some Google search results for "nugetizer", like the second search result references a different GitHub project than this one (NuGet/NuGet.Build.Packaging), and the fifth search result, is a blog post that references that GitHub project as well. It seems like the other project is archived, but not actually archived, which is confusing as hell.
The official nugetizer readme.md says, under Why, that the motivation was to provide an alternative clean and clear design but the linked explanation contains self-defining vocabulary words that I don't know the meaning of, like "bait-and-switch packages". I can loosely guess that "bait-and-switch packages" refer to reference assemblies, but I find this confusing, because... why not just call them reference assemblies? Examples like this elongate the learning curve to "mastering nugetizer".
@kzu claims it is easy to debug Nugetizer projects since it's just MSBuild, but that seems to presume the user knows how to debug MSBuild - this feels like a 0.01%'er type thing. I vaguely recall Visual Studio 2015 adding support for stepping through MSBuild XML logic, but I have no idea how to actually do that. It would add a lot of value to the statement that it's easy to debug, by maybe recording some YouTube videos or Twitch sessions demonstrating common debugging workflows with Nugetizer.
It seems like rather than doing
nugetize --debug
, it would be a lot more efficient to just add verbose output to the nugetizer command line tool instead. For example, if PackagePath is wrong, it would be nice if the there was a clue as to which target raised the error validation, rather than just get "D:\Users\John.Zabroski\.nuget\packages\nugetizer\0.7.0\build\NuGetizer.Shared.targets(277,5): error : Target path 'D:\Users\John.Zabroski\.nuget\packages\myvendor.odata\1.0.0.2385' contains invalid characters. [D:\Users\John.Zabroski\source\infrastructure\master\Prototype\my.csproj]
"I don't really understand the relationship between Nugetizer and dotnet-nugetize. I don't particularly understand why I'm adding a PackageReference to Nugetizer and then calling
nugetize my.csproj
, and I don't really understand the output ofnugetize
(although I am making a tiny bit of progress there, the initial output was really confusing and didn't make a lot of sense to me).I am struggling to understand some of the examples in @kzu's blog post, for example:
Initially, I thought this would automatically download the Newtonsoft.Json command based on the description, but all it is really doing is is adding anything with PackFolder="Dependency" to your nuspec's
<dependencies>
. I don't understand what's special about this, since it seems like a verbose way to accomplish what SDK Path does. I think the more accurate description of this is that you can "Add ambient package dependencies directly to your nuspec, even if your csproj doesn't include them as a PackageReference." In other words, an ambient package is one that isn't directly referenced by your code but should be included in the final output (e.g., a plug-in or its inverse, the shell that hosts the plug-in). Agree? I don't know, just coming here as a rookie trying to figure things out.After studying this more closely, I also think the whole point of PackageFile PackFolder="Dependency" is to increase the speed of building a nuspec file. That seems kind of strange to me, since I don't ordinarily spend a lot of time thinking about my packing process, and it means that I no longer get the benefits of PackageReference restoring the package locally? It seems like it would be a lot cleaner long-term if we stuck with PackageReference and supported an attribute on PackageReference Restore="false" to opt it out of the nuget restore process? Am I thinking about this the wrong way?
Task-wise, I am struggling with how I can "transclude" one Nuget package with a csproj in my solution. I want the NuGet package to get dumped into the bin folder and for that NuGet package to be treated as the true host for my csproj - a sort of "Remora" design pattern where the csproj comes along for the ride with the referenced NuGet package. In my case, I view the csproj as the plug-in, and the NuGet package as the host - not to get too philosophical.
Coding-wise, I am struggling with how to know if I am doing MSBuild best practices, as this veers pretty far from the mainstream of how I use MSBuild on a daily basis. I feel like the prototype I have created is a giant mess. For example, when I run
dotnet build
, the bin directory is different from when I rundotnet nugetize
. The contents really shouldn't change. But I don't really have a deep understanding of where things are running amiss.@kzu's blog post mentions a couple of tricks, like using the Microsoft.Build.NoTargets SDK or the Microsoft.Build.Traversal, but I don't quite understand what Microsoft.Build.NoTargets does - it seems like dotnet build still works if I use it instead of Microsoft.Project.SDK - and I don't quite understand what the utility is of learning it (I don't see a C# sub-reddit or twitter hashtag dedicated to these esoteric scenarios, so I imagine the ramp up time to learn them is non-trivial).
Running
dotnet nugetize
on a solution produces an error if at least one project doesn't PackageReference Nugetizer - this seems odd, in that I don't see why my csproj's dedicated to nuget packaging need to have other csproj's know about nugetizer. Seems to violate the open-closed principle.When using PackageFile and looking at Dependencies under the csproj in VisualStudio Solution Explorer, it reports a warning icon on the csproj and a red x document icon on the PackageFile dependency. I'm not really sure what these mean, but it's definitely distracting and shows that "drop-in replacement" of Nugetizer for SDK Pack is not really quite there yet.
After all this feedback and write-up, I kind of see why people complain about wanting SDK Pack to just work. This took me a full day just to wrap my head around, and I don't think it was a productive use of my time :( - at least not yet - but hopefully it is helpful in making this project more accessible to others in the future.
Beta Was this translation helpful? Give feedback.
All reactions