Reputation: 688
We recently moved from one big SLN file to multiple ones. So now the folder structure is like this:
When I check-in in Visual Studio Online, a build is triggered. This build is configured to retrieve nuget packages (so the packages folders are not checked in).
In the csproj files of Solution1, I configured all the paths pointing to packages to be like this:
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\Solution1WebApp\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
But the build keeps failing and I get warnings like this:
C:\Program Files (x86)\MSBuild\14.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1819, 5)
Could not resolve this reference. Could not locate the assembly "Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
And I think these warnings are causing exceptions such as:
The type or namespace name 'xxx' does not exist in the namespace 'yyy' (are you missing an assembly reference?)
So am I missing something? Are the paths correctly configured?
Thanks for any help.
Upvotes: 0
Views: 513
Reputation: 577
remove the references and the items that it mentions in the packages.json file.
add them back in to the project within the solution that its doesn't find the files.
save and commit.. worked for me.
Upvotes: 0
Reputation: 688
Ok I found the answer. The packages path must remain without the solution name:
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
In VSO build definition, I added a build step for each of the solution (one step for the Libraries, one for the Unit Tests and one for the Web App).
This way, each solution is being built and the paths can remain the same as locally on our PC.
Upvotes: 2