Regarding your concern about the analyzer running against the unit tests, I'm building a .NET Core 2.0 application. Here's a sample of our CSPROJ file for the test assembly. Hope this helps...
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<ProjectGuid>{ProjectGuid}</ProjectGuid>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.1" />
<PackageReference Include="Moq" Version="4.8.2" />
<PackageReference Include="MSTest.TestAdapter" Version="1.2.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyAssembly.csproj" />
</ItemGroup>
</Project>