-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Can't get a project to pack correctly (multi-project, with analyzer) #54
Comments
Here's a similar package that can serve as inspiration: https://github.com/moq/moq/blob/main/src/Moq.Package/Moq.Package.msbuildproj. I strongly recommend creating a packaging project separate from any of the libraries, so you have full control of where each project goes. Finally, the project doesn't have a Please do let me know how it goes with those tips! And thanks a lot for the incredibly detailed report. |
I'm closing for now, plz do reopen if you have further doubts or if the pointers I shared aren't sufficient. I plan on documenting the packaging project support too. You can follow that progress on #55. |
Hey @kzu, sorry for the delay! |
Hm, I wouldn't worry for the "locally" scenario much. You should have unit tests for ensuring your generator works (checkout github.com/kzu/avatar, for example). Even for nugetizer itself, I just build a local nuget package which (thanks to nugetizer) is pruned from the local nuget cache, so you can test it out locally by just adding a package source pointing to the package output path directly (see https://github.com/kzu/avatar/blob/main/src/Acceptance/Directory.Build.props#L8-L11 for example). Also, keep in mind that source generators must target NS2 or they won't work properly everywhere (spent countless hours going down that rabbit hole), so the collection of "runtime dependencies" is extremely brittle and tricky. You'll most likely need some targets that resolve dependencies depending on the current MSBuild runtime ( Keep me posted! |
Overview
Hello, I discovered this project yesterday and it looks super promising, so great work on this! 😄
I've been trying to use this in my own project, ComputeSharp, but so far I have not been able to figure out how to configure this correctly, and I'm wondering what I'm doing wrong. I looked at the docs and I couldn't find a solution there either.
I'm trying to build/pack this .csproj file in particular. The structure of my project is like this:
NuGet package structure (click to expand):
So essentially:
ComputeSharp
package on NuGet, including all assemblies..SourceGenerators
assembly will need to automatically be added as an analyzer to consuming projects.To do this, I did the following in the .csproj file:
I have a few issues though:
nugetize
tool on my project, I get a message sayaing "the project is not packable", even though I did add all the packing metadata to it. I also tried settingPack=True
andPackOnBuild=True
, same result.nugetize
tool, it seems the analyzer is not put in the correct folder. It seems theanalyzers/dotnet/cs
folder is created but just remains empty, and the analyzer is instead added as if I was using multi-targeting in my project. Am I doing something wrong here in the .csproj? I get the following output:Nugetize result (click to expand):
dotnet pack -c Release
, I just get no package at all - the command runs with no errors but it just does nothing. I think this is caused by that "project is not packable" message from above, but I don't get why that is.EDIT: just noticed that adding the
ProjectReference
to the .csproj like that also causes the SG to break when used in the sample projects. Not sure if this is expected or if it's just a thing that happens when used locally and not through NuGet. Would love to have a way to make this work in both cases though, and I'm also not sure thatProjectReference
for the SG in the main project is correct at all, since the SG is not actually a dependency of that project 🤔I couldn't find any info on the docs/readme specifically regarding these "mixed" scenarios, with a single package containing both binaries to be used by consumers, as well as a SG that should also be added as an analyzer by consuming projects.
Steps to Reproduce
nuget
src\ComputeSharp
dotnet build -c Release
anddotnet pack -c Release
Expected Behavior
The package would be created with the referenced projects in the correct location.
Of course, I'm very probably just missing something obvious here, but I can't figure out what 😅
Version Info
0.6.0
The text was updated successfully, but these errors were encountered: