`dotnet run` needs to pass NuGet cache probing path to dotnet.exe
@schellap, this is tracking the work to provide dotnet.exe with an additional probing path in the dotnet run scenario. Can you provide a link for the relevant dotnet.exe issue so we can take a dependency on it?
/cc @gkhanna79
@brthor, once @shellap is ready for this change please prioritize the work.
@schellap @gkhanna79 Can you please provide some more context on this feature?
The additional probing path is necessary to specify nuget packages cache and there will no more reference or fallback to it unless it is explicitly passed in to the app.
NuGet packages cache is an external artifact that is outside the FX and the app and could potentially be corrupt or be mucked with -- so the host will no longer know about this location unless specified. This means any code that relies on the nuget cache being the last resort will break. For example: xunit.
Currently the host detects it to be ~/.nuget and %USERPROFILE%\.nuget. This will no longer work.
I don't quite understand this bug. So if I run a dll using dotnet, all depended outside of the shared framework need to be copied to hr output folder?
@davidfowl, no, the host gives a choice to where you want to look for the --packages. CLI or app can still specify path (potentially pass along the --packages or specify --additionalprobingpath to nuget cache) to the host, but that is up to the app.
The intent here being, for a production app (non dev scenario) NuGet cache shouldn't turn into a GAC where it is left in a bad state by users on a machine and we might hit issues because of that.
when was this decision made?
For non dev scenarios, the app closure is either app local or in shared framework (excluding servicing or antares cache).
The dev scenario would not have the above true and thus, may require a fallback. This argument is to support that fallback. @davidfowl we talked about this multiple times in our marathon syncs and is called out in OneNote too.
I can't recall anything about explicitly passing he packages folder. So it means that dotnet run will work but dotnet foo.dll won't work? So all parties need to understand when to pass in the packages folder?
When does a production app scenario not have a complete closure between shared fx and app?
Who said anything about production? I'm on my dev box and I'm not using dotnet run. Now I have to pass in the packages folder?
No you dont. Why would you need to?
Also, please have a look at the activation OneNote. If that does not clarify, feel free to chat tomorrow.
what gets copied to the output folder on build?
If the output of build/compile does not result in an activatable portable or standalone app (equivalent to what happens in publish), then you are still in "dev" mode and would need to use "dotnet run" to execute the app.
"dotnet run" implementation will take care of passing this flag to indicate to the host the additional cache that needs to be probed. The user of "dotnet run" is abstracted away from the detail since for a production scenario (full published portable or standalone app, whether or not on your dev box) will not need such a cache.
"dotnet
Are there more situations where the information for the packages cache location is needed?
For example given the directory structure:
bin\
foo.dll
foo.deps.json
Invoking dotnet bin/foo.dll would load the foo.deps.json and the cache information was not passed in.
Is this intended to be a failure scenario or does the host retain some fallback logic?
When an application is published, all of its dependency closure falls in one of the following two categories:
- For a portable app, the closure is split between SharedFramework and AppLocal locations
- For standalone app, the closure is all within the AppLocal location
As a result, there should never be a need to reference a fallback location. Such a need only arises when the application is being developed and, thus, has not been published. Scenarios like "dotnet run" or doing "dotnet
For "dotnet run" like scenarios, it is very clear to the muxer that it needs to invoke the CLI, which will, in turn, pass the additional probing path.
For scenarios like "dotnet
- We make a statement that for non-published applications to run, one always must do "dotnet run
" to execute it, OR - There needs to be a hint in app.runtimeconfig.json or app.deps.json, for the non-published app case, that the muxer reads to determine that the application is not published and map the invocation to "dotnet run
" so that CLI does the right thing and pass the additional probing path.
Thus, for your scenario above @brthor, we could just say that you need to invoke the unpublished app as "dotnet run bin/foo.dll" and the right thing will happen. However, since folks are already using "dotnet
Ofcourse, once the app is published (portable or standalone), there will be no such hint at all.
@anurse @schellap Thoughts?