question

rainbowguy-3883 avatar image
0 Votes"
rainbowguy-3883 asked karenpayneoregon commented

Visual Studio 2019 custom database unit test not working SSDT

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


dotnet-visual-basic
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

karenpayneoregon avatar image
0 Votes"
karenpayneoregon answered

Seems this package is not available for .NET Core, only .NET Framework

83421-figure1.png

You should clean up your tags (not going to solve the current issues)

83422-figure2.png



figure1.png (12.0 KiB)
figure2.png (56.0 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

rainbowguy-3883 avatar image
0 Votes"
rainbowguy-3883 answered karenpayneoregon commented

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



image.png (8.1 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Seems like this might be done with a non-net core unit test project or forego a unit test, instead write up SQL in SSMS to perform manual test.

1 Vote 1 ·
rainbowguy-3883 avatar image
0 Votes"
rainbowguy-3883 answered karenpayneoregon commented

It works.

Replaced the

<TargetFramework>net5.0</TargetFramework>

by .NET Framework 4.7.

Thx.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Yes because using Framework 4.7 is compatible with this package while it's not with .NET5. My guess is

  • There will be a .NET Core package in the future

  • Microsoft will not create a .NET Core package

  • A external entity will create a .NET Core package


0 Votes 0 ·