Search code examples
c#visual-studio-2015nugettfsbuildazure-devops

Visual Studio Online - The type or namespace name yyy does not exist in the namespace xxx


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.


Solution

  • 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>