Visual Studio 2019 custom database unit test not working SSDT

rainbow_guy 41 Reputation points
2021-03-31T13:13:40.027+00:00

Hi I am using VS 2019 to try create custom unit tests as in below article:
walkthrough-use-custom-test-condition-to-verify-stored-procedure-results

When I go to my own project however, my custom test is not showing up in the test designer drop down. The code compiles but I have 2 warnings as saying target framework may not be fully compatible for Microsoft.Data.Tools.MSBuild and Microsoft.Data.Tools.UnitTest that i installed from NuGet.

<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net5.0</TargetFramework> <SignAssembly>true</SignAssembly> <AssemblyOriginatorKeyFile>SampleKey.pfx</AssemblyOriginatorKeyFile> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.Data.Tools.Msbuild" Version="16.0.62004.28040" /> <PackageReference Include="Microsoft.Data.Tools.UnitTest" Version="16.0.62004.28040" /> < PackageReference Include="System.ComponentModel.Composition" Version="5.0.0" /> </ItemGroup> <ItemGroup> <Reference Include="Microsoft.Data.Tools.Schema.Sql"> <HintPath>..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130\Microsoft.Data.Tools.Schema.Sql.dll</HintPath> </Reference> </ItemGroup> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\SSDT\Microsoft.Data.Tools.Schema.Sql.UnitTesting.targets" Condition="'$(VisualStudioVersion)' == ''" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.Sql.UnitTesting.targets" Condition="'$(VisualStudioVersion)' != ''" /> </Project> >  
  

Any suggestions what I might be missing out please? Thx

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,568 questions
0 comments No comments
{count} votes

2 additional answers

Sort by: Most helpful
  1. rainbow_guy 41 Reputation points
    2021-03-31T17:12:07.687+00:00

    Hi

    Thanks for reply and pointing out the problem.

    It seems MSBuild I downloaded from nuget has the same problem?

    Please find below screenshot. Any alternatives you suggest on where to get these packages?

    83412-image.png


  2. rainbow_guy 41 Reputation points
    2021-04-01T13:50:32.597+00:00

    It works.

    Replaced the

    <TargetFramework>net5.0</TargetFramework>

    by .NET Framework 4.7.

    Thx.