2017-09-08 4 views
3

Noch neu bei Travis-CI und wollte sehen, ob es etwas ist, was ich mache oder nicht. Ich erhalte einen Buildfehler in Travis-CI, aber nicht lokal.Travis-CI-Build-Fehler "Der Typ oder Namespace-Name 'Extensions' existiert nicht im Namespace"

Beispiel .NET Core 2.0 App. Wenn man durch den Build ich folgende Fehlermeldungen an:

error CS0234: The type or namespace name 'Extensions' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

und

error CS0246: The type or namespace name 'IConfiguration' could not be found (are you missing a using directive or an assembly reference?)

Hier ist ein Link auf die Config-und Job-Protokoll:

https://travis-ci.org/ovation22/DapperRepository/jobs/273068340

+2

Nun * kurz vor * diesem Fehler, erhalten Sie: '/usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1987,5): Warnung MSB3245: Konnte diesen Verweis nicht auflösen. Konnte die Assembly "Microsoft.Extensions.Configuration.Abstractions" nicht finden. "Ich würde mich wundern, wenn das nicht verwandt wäre. –

+0

(Es ist seltsam, dass der Dotnet-Wiederherstellungsschritt erwähnt Microsoft.Extensions.Configuration.Abstractions sowohl für v1.0.0 als auch v2.0.0.) –

Antwort

3

Es gibt eine Warnung nur oben ist der Fehler:

/usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.Extensions.Configuration.Abstractions". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/home/travis/build/ovation22/DapperRepository/Example.Repository/Example.Repository.csproj]

DapperRepository.cs(7,17): error CS0234: The type or namespace name 'Extensions' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [/home/travis/build/ovation22/DapperRepository/Example.Repository/Example.Repository.csproj]

DapperRepository.cs(16,33): error CS0246: The type or namespace name 'IConfiguration' could not be found (are you missing a using directive or an assembly reference?) [/home/travis/build/ovation22/DapperRepository/Example.Repository/Example.Repository.csproj]

Werfen wir einen Blick auf Example.Repository.csproj nehmen:

<ItemGroup> 
    <PackageReference Include="Dapper" Version="1.50.2" /> 
</ItemGroup> 

Das sieht gut aus. Aber wo ist Microsoft.Extensions.Configuration.Abstractions? Schauen wir uns ein wenig tiefer:

<Reference Include="Microsoft.Extensions.Configuration.Abstractions"> 
    <HintPath>C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.extensions.configuration.abstractions\2.0.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath> 
</Reference> 

So msbuild Sie sagen, dass es bei C:\Program Files zur Verfügung steht. Travis führt das unter Linux aus, wo dieser Pfad offensichtlich nicht existiert.

Versuchen Sie eine PackageReference wie Dapper in diesem csproj. Das sollte das beheben.

+0

Doh, ich fühle mich albern. Ich muss alt-geben R # glücklich. Das hat den Trick gemacht. Vielen Dank! – ovation22

Verwandte Themen