1
votes

I have a solution from Visual Studio 2015, using the .NET Framework 4.6. Locally, I can compile without any problem and I am using NuGet in its latest version (3.1).

When I check-in and then build using Visual Studio Online, I get errors like this:

  • Plumbing\DALContainerRegistration.cs (1): The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
  • Storage\BlobStorage.cs (5): The type or namespace name 'WindowsAzure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

I understand that I am missing these references on the Build server, but I don't see how I can resolve this. In the two examples above, I get the Enterprise library and Azure storage library from NuGet, so there is apparently no reason why it would not work.

I have a NuGet.config at the root of my sln and here is its content:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

Do you have any idea what can be wrong? If you need any other info, please let me know.

2
What is your target build framework?bowlturner
Have you enabled the Package Restore options in the solution? Go to Tools > NuGet Package Manager > Package Manager Settings. Once the dialog opens, expand NuGet Package Manager. In the General tab, ensure Allow NuGet to download missing packages and Automatically check for missing packages during build in Visual Studio are checked.SwDevMan81
@bowlturner: .NET Framework 4.6DotNetMatt
@SwDevMan81: Yes these options are enabledDotNetMatt

2 Answers

1
votes

You need to enable Restore NuGet Packages. In VSO Build vNext you can do this in the Build step. enter image description here

To create a new build definition: enter image description here

0
votes

I could solve this by modifying the NuGet.config file as follow:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <packageSources>
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
    <add key="nuget.orgv3" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
  <disabledPackageSources />
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
</configuration>