-
Notifications
You must be signed in to change notification settings - Fork 224
Flexible packages folder locations for kpm and runtime #436
Comments
I think we should use NuGet's repositoryPath and do any necessary refactoring to be able to get the setting. nuget.exe config repositoryPath -aspath is a good way to get it from the command line today. I don't think we'd want to support 2 config systems. |
@jeffhandley I'm not 100% opposed to being able to read that setting from nuget.config. We already read nuget.config for kpm but I don't want the runtime itself to have to understand the nuget.config hierarchy with clears and overrides. |
Maybe can can just support a nuget.config next to the solution |
I expect you'll end up with the same feature requests we got though, for instance allowing settings to be specified once on the machine. It would be useful to be able to have a NuGet.config on the root drive of my server, and all apps share a repository path configured on the server without having to put the setting into the solution folder. |
you can do that with an environment variable, see KRE_PACKAGES. |
it is worth looking into regardless. |
@jeffhandley what about the folder layout? |
I like the idea of having a central packages folder for the local dev box. Whether it should read from KRE_PACKAGES or nuget.config, I'm not sure.
I would be careful relying on any files next to the solution. The solution concept is very loose in msbuild terms. Also a project can be in several solutions and in a lot of cases the .sln file is in some arbitrary location.
For .csproj when a nuget pkg adds a reference it is added in the following way. <ItemGroup>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, ...cture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
</ItemGroup> I think we can make this recognize a local cache as well. We could write the elements as something more like the following. <PropertyGroup>
<PackagesDir Condition=" '$(PackagesDir)'=='' ">..\packages\</PackagesDir>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, ...cture=MSIL">
<Private>True</Private>
<HintPath>$(PackagesDir)Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
</ItemGroup> When a build is kicked off in VS we can set the PackagesDir as a global MSBuild property. For command line builds we can either:
|
@sayedihashimi In the past I've tried things like the above and it doesn't work (due to when different parts of the csproj get evaluated in VS). What you really want is a node that will run the same logic to figure out the actual hint path at build time. We're also using {name}/{version} instead of {name}.{version} |
@GrabYourPitchforks @blowdart because they are interested in this from a servicing perspective. |
Shouldn't change servicing but sure |
Servicing might want to use a similar solution. Or not. Or maybe. |
Today we find packages based on a few heuristics, see #213 for the issues that arise. KPM and K will be changed to do the following:
--packages
was passed to either kpm or k then use that as the packages location.KRE_PACKAGES
was set, then use that as the packages location.If the global.json packages property is set then use that as the packages folder
%userprofile%\.kpm\packages
(windows) or$HOME/.kpm/packages
(*nix) will be used.Other things that will change as a result:
{name}.{version}
. Instead, it will be{name}/{version}
kpm pack
should write the packages folder into the global.json so that the behavior is deterministic for a packaged application.Open questions:
/cc @glennc @lodejard @Praburaj @sayedihashimi @lucamorelli @ChengTian @Eilon
The text was updated successfully, but these errors were encountered: