Still new to Travis-CI and wanted to see if it's something I'm doing or not. I'm getting a build error in Travis-CI, but not locally.
Sample .NET Core 2.0 app. Going through the build I receive the following errors:
error CS0234: The type or namespace name 'Extensions' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
and
error CS0246: The type or namespace name 'IConfiguration' could not be found (are you missing a using directive or an assembly reference?)
Here's a link to the config and job log:
https://travis-ci.org/ovation22/DapperRepository/jobs/273068340
There is a warning just above the error:
/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]
Lets take a look at Example.Repository.csproj
:
<ItemGroup>
<PackageReference Include="Dapper" Version="1.50.2" />
</ItemGroup>
That looks fine. But where is Microsoft.Extensions.Configuration.Abstractions
? Lets look a little lower:
<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 you are telling msbuild that it is available at C:\Program Files
. Travis is running this in Linux where this path obviously doesnt exist.
Try adding a PackageReference
just like Dapper
in that csproj. That should fix this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With