Jonathan Crossland
Jonathan Crossland

Reputation: 31

Nuget Pack - cant find package that was just installed

Scenario in VS 2015. Nuget 3.5

Two projects. A and B A creates Nuget package A. (Does depend on other nuget sources) B installs Nuget Package A. B creates Nuget package B.

All packages are packed and copied on to a drive letter. Visual Studio has the source.

Installing Nuget Package A into B works perfectly.

But when creating Package B

Unable to find 'packageA.nupkg'. Make sure the project has been built.

My config has the sources, thats why it installed in the first place.

I have just installed this package, it is within the packages folder, it is listed in packages.config.

Any ideas?

<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
     <PropertyGroup>
       <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
       <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
       <ProjectGuid>{2E3C3C47-80B4-4B51-9039-438380C9A926}</ProjectGuid>
       <OutputType>Library</OutputType>
       <AppDesignerFolder>Properties</AppDesignerFolder>
       <RootNamespace>LucidOcean.Atlantis.Core</RootNamespace>
       <AssemblyName>LucidOcean.Atlantis.Core</AssemblyName>
   <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
   <FileAlignment>512</FileAlignment>
   <RestorePackages>false</RestorePackages>
   <TargetFrameworkProfile />
 </PropertyGroup>
 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <DebugSymbols>true</DebugSymbols>
   <DebugType>full</DebugType>
   <Optimize>false</Optimize>
   <OutputPath>bin\Debug\</OutputPath>
   <DefineConstants>DEBUG;TRACE</DefineConstants>
   <ErrorReport>prompt</ErrorReport>
   <WarningLevel>4</WarningLevel>
 </PropertyGroup>
 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
   <DebugType>full</DebugType>
   <Optimize>false</Optimize>
   <OutputPath>bin\Release\</OutputPath>
   <DefineConstants>TRACE</DefineConstants>
   <ErrorReport>prompt</ErrorReport>
   <WarningLevel>4</WarningLevel>
   <DebugSymbols>true</DebugSymbols>
 </PropertyGroup>
 <PropertyGroup>
   <SignAssembly>true</SignAssembly>
 </PropertyGroup>
 <PropertyGroup>
   <AssemblyOriginatorKeyFile>lucidocean.snk</AssemblyOriginatorKeyFile>
 </PropertyGroup>
 <ItemGroup>
   <Reference Include="Atlantis.Extensibility, Version=2017.0.0.9, Culture=neutral, PublicKeyToken=ff48a18f294fb322, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\Atlantis.Extensibility.2017.0.0.9\lib\net461\Atlantis.Extensibility.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="AWSSDK, Version=2.3.55.2, Culture=neutral, PublicKeyToken=9f476d3089b52be3">
     <HintPath>g:\LucidOceanNugetServer\AWSSDK.2.3.55.2\lib\net45\AWSSDK.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
     <HintPath>g:\LucidOceanNugetServer\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="LucidOcean.Atlantis.Core, Version=2017.0.0.3, Culture=neutral, PublicKeyToken=ff48a18f294fb322, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\LucidOcean.Atlantis.Core.2017.0.0.3\lib\net461\LucidOcean.Atlantis.Core.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="LucidOcean.Business, Version=2017.0.0.9, Culture=neutral, PublicKeyToken=ff48a18f294fb322, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\LucidOcean.Business.2017.0.0.9\lib\net461\LucidOcean.Business.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="LucidOcean.Data, Version=2017.0.0.9, Culture=neutral, PublicKeyToken=ff48a18f294fb322, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\LucidOcean.Data.2017.0.0.9\lib\net461\LucidOcean.Data.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="LucidOcean.Data.Utility, Version=2017.0.0.9, Culture=neutral, PublicKeyToken=ff48a18f294fb322, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\LucidOcean.Data.Utility.2017.0.0.9\lib\net461\LucidOcean.Data.Utility.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="LucidOcean.Web.Caching, Version=2017.0.0.3, Culture=neutral, PublicKeyToken=ff48a18f294fb322, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\LucidOcean.Web.Caching.2017.0.0.3\lib\net461\LucidOcean.Web.Caching.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="LucidOcean.Web.Communication, Version=2017.0.0.1, Culture=neutral, PublicKeyToken=ff48a18f294fb322, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\LucidOcean.Web.Communication.2017.0.0.1\lib\net461\LucidOcean.Web.Communication.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="LucidOcean.Web.Layouts, Version=2017.0.0.4, Culture=neutral, PublicKeyToken=ff48a18f294fb322, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\LucidOcean.Web.Layouts.2017.0.0.4\lib\net461\LucidOcean.Web.Layouts.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="LucidOcean.Web.Security, Version=2017.0.0.9, Culture=neutral, PublicKeyToken=ff48a18f294fb322, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\LucidOcean.Web.Security.2017.0.0.9\lib\net461\LucidOcean.Web.Security.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="LucidOcean.Web.Utility, Version=2017.0.0.8, Culture=neutral, PublicKeyToken=ff48a18f294fb322, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\LucidOcean.Web.Utility.2017.0.0.8\lib\net461\LucidOcean.Web.Utility.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
     <HintPath>g:\LucidOceanNugetServer\Microsoft.Report.Viewer.11.0.0.0\lib\net\Microsoft.ReportViewer.Common.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="Microsoft.ReportViewer.ProcessingObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
     <HintPath>g:\LucidOceanNugetServer\Microsoft.Report.Viewer.11.0.0.0\lib\net\Microsoft.ReportViewer.ProcessingObjectModel.DLL</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
     <HintPath>g:\LucidOceanNugetServer\Microsoft.Report.Viewer.11.0.0.0\lib\net\Microsoft.ReportViewer.WebForms.DLL</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="Microsoft.SqlServer.Types, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
     <Private>True</Private>
   </Reference>
   <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
     <HintPath>g:\LucidOceanNugetServer\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="SimpleImpersonation, Version=2.0.1.27158, Culture=neutral, processorArchitecture=MSIL">
     <HintPath>g:\LucidOceanNugetServer\SimpleImpersonation.2.0.1\lib\net40-Client\SimpleImpersonation.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="System" />
   <Reference Include="System.ComponentModel.DataAnnotations" />
   <Reference Include="System.Configuration" />
   <Reference Include="System.Core" />
   <Reference Include="System.Drawing" />
   <Reference Include="System.Messaging" />
   <Reference Include="System.Net.Http" />
   <Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
     <HintPath>g:\LucidOceanNugetServer\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="System.Net.Http.WebRequest" />
   <Reference Include="System.Runtime.Serialization" />
   <Reference Include="System.Security" />
   <Reference Include="System.ServiceModel" />
   <Reference Include="System.Web" />
   <Reference Include="System.Web.Extensions" />
   <Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
     <HintPath>g:\LucidOceanNugetServer\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="System.Web.Http.WebHost, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
     <HintPath>g:\LucidOceanNugetServer\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
     <HintPath>$(SolutionDir)packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
     <Private>True</Private>
   </Reference>
   <Reference Include="System.Xml.Linq" />
   <Reference Include="System.Data.DataSetExtensions" />
   <Reference Include="Microsoft.CSharp" />
   <Reference Include="System.Data" />
   <Reference Include="System.Xml" />
 </ItemGroup>

Upvotes: 1

Views: 2140

Answers (2)

Jonathan Crossland
Jonathan Crossland

Reputation: 31

I used this post How can .csproj know about its solution? to output the $(SolutionDir) and discovered a discrepancy.

The csproj, was one level below the folder with the .sln, the gave me a $(SolutionDir) that was incorrect, when calling nuget pack b.csproj A.package was one level higher than B.package and B was going one down and not finding the packages folder.

folder\solution\packages folder\solution\ProjectA folder\ProjectB

msbuild and Visual Studio 2015 had the same problem.

Since I was using msbuild and nuget via the commandline and the error "cant find package" does not contain the folders its looking for, it became a bad issue.

Nuget really should output more on the pack command than just cant find packagename. The complete folder location would have been helpful.

I moved the projects to the same folder depth and it finds the package. Curiously, the csproj Import/Dependencies only had ..\ on the hint which was not good enough to find the packages. I think there may be an issue with VS.NET 2015 updating the hint location.

Upvotes: 2

Leo Liu
Leo Liu

Reputation: 77006

Unable to find 'packageB.nupkg'. Make sure the project has been built.

This error should be unable to find "packageA.nupkg" rather than "packageB.nupkg". Am I right?

If yes, that is because the packages folder is not at the expected location.

You can check whether PackageA.nupkg exists in the packages folder under your solution folder or not. When nuget pack package with a dependency on the packagedirectory then there should be an option to override that configuration via cmd line, but the option -PackageDirectory has not been added into the nuget pack command. It`s intended to be added in version 3.61. For more information you can refer to the Issue 3378.

To resolve this issue, you can set the packages folder at the expected location or use the .nuspec file instead of .xxproj.

Hope this can help you.

Upvotes: 1

Related Questions