Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing Microsoft.Data.Tools.Schema.Sql.UnitTesting. Again

The bug is very old but MS didn't fix it so far.

I had a VS2015 solution (many projects, with main ASP.NET one) and I opened it in VS 2017.

Here is what I saw when I tried to build it:

So, I figured, okay, some referenced broke, I went into Project References, removed those two (...Sql.UnitTesting and ...Tools.Components), and tried to add them back. What did I saw? Of course, this:

The version is wrong, its 15.1.0.0 instead of previous 15.0.0.0 (for both DLLs). Big deal, you say, but it still doesn't compile:

It tells me that the versions are mismatched and I have to create some assembly-bindings in the web.config file. Which I did, first manually, then via the double-click on the warning, as it suggested. Nothing changed. I still can't get my project build.

Previous SO questions (Automatic reference to Microsoft.Data.Tools.Schema.Sql.UnitTesting, Where is the Microsoft.VisualStudio.TestTools.UnitTesting namespace on VS2010?) don't help much, I cannot remove SSDT component, as it breaks the loading of the web-project completely. And my project isn't any sort of SQL Testing project. It is just a regular ASP.NET 4 web app.

What can I do to fix this?

like image 850
AgentFire Avatar asked Jun 17 '17 11:06

AgentFire


2 Answers

enter image description here

Select NO and the Identity and Path should automatically resolve.

enter image description here

like image 175
Shane Avatar answered Sep 18 '22 17:09

Shane


In your test project file, remove this code:

<Import Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.Sql.UnitTesting.targets" Condition="'$(SQLDBExtensionsRefPath)' != ''" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.Sql.UnitTesting.targets" Condition="'$(SQLDBExtensionsRefPath)' == ''" />
<PropertyGroup>
    <SsdtUnitTestVersion>2.0</SsdtUnitTestVersion>
</PropertyGroup>

And replace it with this:

<ItemGroup Condition="$(VisualStudioVersion) == '15.0'">
    <Reference Include="Microsoft.Data.Tools.Schema.Sql, Version=13.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>$(SSDTPath)\Microsoft.Data.Tools.Schema.Sql.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="Microsoft.Data.Tools.Schema.Sql.UnitTesting, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>$(SSDTUnitTestPath)\Microsoft.Data.Tools.Schema.Sql.UnitTesting.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="Microsoft.Data.Tools.Schema.Sql.UnitTestingAdapter, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>$(SSDTUnitTestPath)\Microsoft.Data.Tools.Schema.Sql.UnitTestingAdapter.dll</HintPath>
      <Private>True</Private>
    </Reference>
  </ItemGroup>
<PropertyGroup>
    <SsdtUnitTestVersion>3.1</SsdtUnitTestVersion>
  </PropertyGroup>
 <Import Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.Sql.UnitTesting.targets" Condition="$(VisualStudioVersion) != '15.0' And '$(SQLDBExtensionsRefPath)' != ''" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.Sql.UnitTesting.targets" Condition="$(VisualStudioVersion) != '15.0' And '$(SQLDBExtensionsRefPath)' == ''" />

This is as per the official microsoft dev community help thread here.

Although for me it didn't work. Had to add propertygroup tags around ssdt version. You might want to keep it or remove it as per your project configurations.

like image 32
Prasad Bhalerao Avatar answered Sep 20 '22 17:09

Prasad Bhalerao