premake/premake-core

Nuget keyword not respecting nuget.config, project location, actual lib names

開放

#569 建立於 2016年8月25日

 (22 則留言) (0 個反應) (0 位負責人)C (651 個分叉)auto 404
bughelp wantedvs20xx

倉庫指標

星標
 (3,621 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Hi. I'm currently evaluating premake 5 as a possible new build system at work. So far I'm liking it lots.

I'm having some trouble getting nuget dependencies working though. The first thing I tried to do with it was add a dependency on NUnit 3.4.1 in one project of a vs2015 multi-project solution. I realize it's bleeding edge days for premake 5 and I may have to invest some effort into making it work, but the user guide says if something's not working as you expect, submit a ticket. Also from reading some of your dev discussions and pull requests I think this probably touches on larger questions.

So here goes. :)

  1. There appear to be assumptions that a NuGet package contains only one relevant lib and that it has the same name as the package. These are not always the case, but as far as I can tell the .nupkg file doesn't actually tell you which files you want; it might actually be correct to just find and use all the DLLs in the appropriate subdirectory of the package.

  2. The content of the generated packages.config file is correct, but it is placed next to the .sln file rather than the .csproj that actually has the dependency.

  3. The properties added to the .csproj are not correct; in addition to #1 above it adds dependencies for every .net framework version, and fails to add the file include for packages.config. Because of this the package will never be downloaded and the build will fail.

  4. If you have a nuget.config file set up so that all your packages download to one nice clean place, that location is not respected. See http://docs.nuget.org/release-notes/nuget-2.1#Specify_%e2%80%98packages%e2%80%99_Folder_Location - there are several places this config can go. (Actually, I'd be totally cool with premake generating the nunit.config file next to the .sln as long as it allowed specifying extra package sources as well as a custom repository path.)

Here are the diffs to the .csproj file if I add the NuGet package manually, using the solution generated from the attached repro case with the nuget line commented out. This is what should happen. Also note that it's using the .net 4.5 version even though I use 4.6, because there is no 4.6 version in the NuGet package.

42a43,47
>     <Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
>       <SpecificVersion>False</SpecificVersion>
>       <HintPath>..\..\..\nuget_packages\downloaded\NUnit.3.4.1\lib\net45\nunit.framework.dll</HintPath>
>       <Private>True</Private>
>     </Reference>
57a63,65
>   </ItemGroup>
>   <ItemGroup>
>     <None Include="packages.config" />

And here is what actually happens:

43a44,54
>     <Reference Include="NUnit">
>       <HintPath Condition="Exists('..\..\packages\NUnit.3.4.1\lib\net10\NUnit.dll')">..\..\packages\NUnit.3.4.1\lib\net10\NUnit.dll</HintPath>
>       <HintPath Condition="Exists('..\..\packages\NUnit.3.4.1\lib\net11\NUnit.dll')">..\..\packages\NUnit.3.4.1\lib\net11\NUnit.dll</HintPath>
>       <HintPath Condition="Exists('..\..\packages\NUnit.3.4.1\lib\net20\NUnit.dll')">..\..\packages\NUnit.3.4.1\lib\net20\NUnit.dll</HintPath>
>       <HintPath Condition="Exists('..\..\packages\NUnit.3.4.1\lib\net30\NUnit.dll')">..\..\packages\NUnit.3.4.1\lib\net30\NUnit.dll</HintPath>
>       <HintPath Condition="Exists('..\..\packages\NUnit.3.4.1\lib\net35\NUnit.dll')">..\..\packages\NUnit.3.4.1\lib\net35\NUnit.dll</HintPath>
>       <HintPath Condition="Exists('..\..\packages\NUnit.3.4.1\lib\net40\NUnit.dll')">..\..\packages\NUnit.3.4.1\lib\net40\NUnit.dll</HintPath>
>       <HintPath Condition="Exists('..\..\packages\NUnit.3.4.1\lib\net45\NUnit.dll')">..\..\packages\NUnit.3.4.1\lib\net45\NUnit.dll</HintPath>
>       <HintPath Condition="Exists('..\..\packages\NUnit.3.4.1\lib\net46\NUnit.dll')">..\..\packages\NUnit.3.4.1\lib\net46\NUnit.dll</HintPath>
>       <Private>True</Private>
>     </Reference>

GitHub won't let me attach a zip file, so for now my repro case example is here: https://drive.google.com/open?id=0B6BLRF-3H7q1ckZtZTg3N3BzUEk - I'm using premake5 built from master/head with VS2015 on Windows 7.

(My next question after getting this working would be, how can I get a path into a NuGet package so I can invoke executables that are distributed that way?)

Also: Hi, Tom! :)

貢獻者指南