You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I'm developing a hot reload plugin for a UI framework. Well, technically, it's already done, and now I'm faced with the real challenge - packaging it.
Naturally, since my package is designed as a development-only dependency, I pack it with -p:DevelopmentDependency=true. Thus, when users install it, the following snippet is added to their project file:
And everything behaves properly whenever the plugin is used with a desktop application, whether it's created via dotnet build or dotnet run.
However, the moment I try to run an Android app via dotnet run, it instantly crashes with a cryptic FileNotFoundException, signifying that the satellite library required for debug builds to function has not been included in the resulting bundle. As far as I understand after four days of digging through the best documentation I have on this topic (i.e., the sources of this repo and eight-year-old issues), this happens because dotnet run for Android builds actually uses the publish routine to generate the output that gets uploaded to the device; and the SDK by default sets Publish="false" for every PackageReference that has its PrivateAssets set to all, causing development-only dependencies to go missing, even though the intent was not to publish the app, but to create a development build for debugging purposes.
Workarounds
The ugly workaround would be to ask users to install the plugin by manually editing their project files and inserting the following snippet there:
Nobody reads documentation these days, so this will just lead to an endless stream of "No work! Crash! How fix?" issues in my repo.
This doesn't actually represent the proper intent of what I'm trying to achieve. I do not want my satellite library to be copied to users' published builds. It's only needed for regular debug builds, which I expect Android builds created by dotnet run to be. However, those unexpectedly differ in semantics from the desktop ones.
Sooooo... Are there any somewhat proper workarounds I can employ within the .props/.targets distributed with my nuget, so that users can simply run dotnet add package Foo and expect everything to work as intended?
Description
Hi! I'm developing a hot reload plugin for a UI framework. Well, technically, it's already done, and now I'm faced with the real challenge - packaging it.
Naturally, since my package is designed as a development-only dependency, I pack it with
-p:DevelopmentDependency=true
. Thus, when users install it, the following snippet is added to their project file:which is equivalent to:
And everything behaves properly whenever the plugin is used with a desktop application, whether it's created via
dotnet build
ordotnet run
.However, the moment I try to run an Android app via
dotnet run
, it instantly crashes with a crypticFileNotFoundException
, signifying that the satellite library required for debug builds to function has not been included in the resulting bundle. As far as I understand after four days of digging through the best documentation I have on this topic (i.e., the sources of this repo and eight-year-old issues), this happens becausedotnet run
for Android builds actually uses the publish routine to generate the output that gets uploaded to the device; and the SDK by default setsPublish="false"
for everyPackageReference
that has itsPrivateAssets
set toall
, causing development-only dependencies to go missing, even though the intent was not to publish the app, but to create a development build for debugging purposes.Workarounds
The ugly workaround would be to ask users to install the plugin by manually editing their project files and inserting the following snippet there:
It's "ugly" because:
dotnet run
to be. However, those unexpectedly differ in semantics from the desktop ones.Sooooo... Are there any somewhat proper workarounds I can employ within the
.props
/.targets
distributed with my nuget, so that users can simply rundotnet add package Foo
and expect everything to work as intended?Related Issues
#27211
#1019
#952
The text was updated successfully, but these errors were encountered: