Visual Studio 2019 custom database unit test not working SSDT

rainbow_guy 41 Reputation points
2021-03-30T17:41:48.64+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

Developer technologies Transact-SQL
SQL Server Other
0 comments No comments
{count} votes

Accepted answer
  1. CarrinWu-MSFT 6,891 Reputation points
    2021-03-31T09:20:56.67+00:00

    Hi @rainbow_guy ,

    Your issue is related to Visual Studio, suggest you post your question in Visual Studio Forum. SQL server general tag means the issues are related to SQL server. You can find all products that supported on Q&A forum from this link.

    Best regards,
    Carrin


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. rainbow_guy 41 Reputation points
    2021-03-31T13:14:48.45+00:00

    Bit complicated with finding the right forum and tags though.
    Ok thanks. Done!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.