Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upFlexible packages folder locations for kpm and runtime #436
Comments
davidfowl
added this to the 1.0.0-alpha3 milestone
Jul 13, 2014
davidfowl
added
enhancement
labels
Jul 13, 2014
davidfowl
self-assigned this
Jul 13, 2014
davidfowl
changed the title
Flexiable packages folder locations for kpm and runtime
Flexible packages folder locations for kpm and runtime
Jul 13, 2014
This comment has been minimized.
This comment has been minimized.
jeffhandley
commented
Jul 13, 2014
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. |
This comment has been minimized.
This comment has been minimized.
@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. |
This comment has been minimized.
This comment has been minimized.
Maybe can can just support a nuget.config next to the solution |
This comment has been minimized.
This comment has been minimized.
jeffhandley
commented
Jul 13, 2014
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. |
This comment has been minimized.
This comment has been minimized.
you can do that with an environment variable, see KRE_PACKAGES. |
This comment has been minimized.
This comment has been minimized.
it is worth looking into regardless. |
This comment has been minimized.
This comment has been minimized.
@jeffhandley what about the folder layout? |
davidfowl
added
2 - Working
and removed
1 - Ready
labels
Jul 13, 2014
This comment has been minimized.
This comment has been minimized.
sayedihashimi
commented
Jul 13, 2014
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:
|
This comment has been minimized.
This comment has been minimized.
@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} |
davidfowl
added
3 - Done
and removed
2 - Working
labels
Jul 15, 2014
This comment has been minimized.
This comment has been minimized.
@GrabYourPitchforks @blowdart because they are interested in this from a servicing perspective. |
This comment has been minimized.
This comment has been minimized.
Shouldn't change servicing but sure |
This comment has been minimized.
This comment has been minimized.
Servicing might want to use a similar solution. Or not. Or maybe. |
davidfowl commentedJul 13, 2014
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