Replies: 17 comments 3 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Here is a new repro, with
Unfortunately, the result is the same when adding this reference. Not so trivial...
The Microsoft.Extensions.Http is a package reference in LibA. The dependency is correctly added (at the top level) for one TFM, but not for the other one, which is not what we're expecting, right ? Don't you think those 3 issues could be fixed ? |
Beta Was this translation helpful? Give feedback.
-
The packaging project is using an SDK that's not a "standard" one. I changed it to The result is: Which is quite close. That said, I think you have a somewhat unusual scenario there, not sure I understand what's the "real" scenario behind it:
I'm not sure why someone would go to a multi-targeting dependency passing through a single-targeting one (LibA). I don't think that's a common scenario, which is likely why this is the first time someone reports it. I may be missing something there, so plz let me know what the concrete scenario is, perhaps it's a missed feature in NuGetizer. If the scenario where the more common (I'd say):
Then things look exactly as you'd expect: Attached is the patched solution. |
Beta Was this translation helpful? Give feedback.
-
The scenario is very common when developing with xamarin: LibB has platform specific implementations (for android, ios, or .net), so it needs multi-targeting. |
Beta Was this translation helpful? Give feedback.
-
I see. I still don't see it as a super common that someone would package the App as a nuget 🤔 . Neither the app logic (the NS). For the LibB author, nugetizer works like a charm for sure. Perhaps the LibA is some sort of reusable UI/app layer... Dunno. The scenario itself is not high priority for me in particular, but I'd gladly take a PR if you want to take a shot at it. NuGetizer has lots of tests that help exercise targets and tasks, which you can use as a guideline. If this is a really really important scenario for you, perhaps you'd consider sponsoring me to look into it more deeply? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Of course it's not about nugetizing an app. It's not even about app logic, and it's not necessarily about UI. It's probably more about low-level reusable components.
For all these exemples, LibA would contain the common logic, and LibB would contain low-level stuff that requires platform specific implementation (accessing to the platform SDK).
Not sure I understand what you mean. The idea is to package LibA+LibB.
Ok, I understand. I'll think about it. Thanks! |
Beta Was this translation helpful? Give feedback.
-
You don't need LibA for sharing common logic. You can have a single project, multi-targeting, that contains both the reference assembly for the API surface you want to expose, as well as the xplat/native code. Something like novotnyllc/MSBuildSdkExtras#47, say. That's where things are going with Maui too and the upcoming SDKs for XA/XI being integrated with .NET6, IIRC. |
Beta Was this translation helpful? Give feedback.
-
Of course. But I think there is a misunderstanding. The split between LibA and LibB does not exist because of platform specific code in LibB. Both LibA and LibB have different purposes (separation of functionality, dependencies, release process, team, whatever the reason...), and it just happens that LibB has platform specific code, and LibA is pure NS. It could be the contrary, but practically LibA is higher level than LibB so there is less chance of having platform specific code in LibA than in LibB. |
Beta Was this translation helpful? Give feedback.
-
My understanding is that with Maui, there is one single application project (with platform specific code), instead of one application project per platform. |
Beta Was this translation helpful? Give feedback.
-
They are all multi-targeting projects. There is no way to have any native app with a single project unless you multi-target. |
Beta Was this translation helpful? Give feedback.
-
Again, not sure I understand what you mean.
Or maybe I've missed something ? |
Beta Was this translation helpful? Give feedback.
-
I was talking Maui, of course. I did the original multi-targeting internal spike for that at Xamarin ;) |
Beta Was this translation helpful? Give feedback.
-
It's been a few days and I haven't heard back. I wanted to check If you agree that given the direction things are going in the Xamarin/Maui timeframe (multi-targeting, single project with shared + native code), this issue is probably a lower priority since it won't be long lived in that single-project multi-targeted world... Thanks! |
Beta Was this translation helpful? Give feedback.
-
Sorry but I don't understand how this relates to Maui:
I'm using a nuspec file, manually maintained, and it works exactly as I want. When using nugetizer, it doesn't work properly. I think this is an issue. It's that simple. I you still think Maui is the solution, now that it is in preview-4, maybe you can provide an example of how it would solve this issue ? |
Beta Was this translation helpful? Give feedback.
-
In Maui everything is a multi-targeted project. And if you follow the Maui samples, you'll see that using conditional compilation for platform-specific code is the way they recommend/suggest using. No need for adding extra projects just to switch a method or two to use platform-specific code. Since doing Maui samples/demos is outside the scope of nugetizer, I'm going to tentatively close this until you have more specific feedback on why/how it doesn't work for your scenario. I still think the way you're trying to implement platform-specific code is not a mainstream scenario, so it's lower priority (and with Maui, again, even less so). That said, sponsoring the project would definitely raise said priority 😉 , but otherwise, my (spare) time is limited to work on specific features/requests from the community. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Is this still an issue? I've fixed a few transitive project issues since this, so it might not be. Could you please give it another try and see how it goes? Now even Maui has shipped, so it should be easier to try out. Thanks! |
Beta Was this translation helpful? Give feedback.
-
I still get the same error with 0.8.0. |
Beta Was this translation helpful? Give feedback.
-
Describe the Bug
When packing a single-target project that references a multi-target project, I'm facing 3 different issues that I'll try to describe here.
I'm a bit lost and I'd really appreciate some help. Thanks
Steps to Reproduce
TestNugetizer.zip
Open the repro TestNugetizer.zip and extract it. It contains 3 projects:
LibA
(a single-target project, referencesLibB
) ;LibB
(a mutli-target project) ;LibPackaging
(a multi-target project, referencesLibA
, and is used to build bothLibA
andLibB
properly).Go to the
build
folder, runclean.bat
first, thenpack.bat
. There are 4 steps (clean, restore, build, pack). It should build all dlls and produce aTestNugetizer.1.0.0.nupkg
file.First issue: open the nupkg file ; the
lib\monoandroid11.0\
folder should contain bothLibA.dll
andLibB.dll
, but it's missingLibB.dll
. Thelib\netstandard2.1\
folder contains both libs, which is expected.Second issue: open the nupkg file, and then the
TestNugetizer.nuspec
file. TheMicrosoft.Extensions.Http
dependency is missing in theMonoAndroid11.0
targetFramework.Third issue: the
pack.bat
produces the following error, which is weird:Version Info
Nugetizer 0.7.0
Beta Was this translation helpful? Give feedback.
All reactions