XUnit, NUnit, MSUnit all run all tests twice VS2022 - nunit

In Visual Studio 2022 the test runner for XUnit, NUnit and MSUnit all run the tests twice (I switch the project between the three).
For XUnit (the last one I landed on and plan on staying with) I have the following nuget packages installed: xunit (2.4.1) and xunit.runner.visualstudio (2.4.3)
I have no relevant VS extensions installed (that I can tell... nothing with XUnit, NUnit, or MSUnit in the name).
My project file is nice and simple:
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<IsPackable>false</IsPackable>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AForge.Video" Version="2.2.5" />
<PackageReference Include="AForge.Video.FFMPEG" Version="2.2.5.1-rc" />
<PackageReference Include="DotNetSeleniumExtras.WaitHelpers" Version="3.11.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.1.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="96.0.4664.4500" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Update="avcodec-53.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="avdevice-53.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="avfilter-2.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="avformat-53.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="avutil-51.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="postproc-52.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="swresample-0.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="swscale-2.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
I'm at a loss. Any help appreciated!!
I'm at a loss.

Had the same problem.
Disabling Fine Code Coverage extension fixed the issue for me.
If that does not solve it, maybe try disabling all the extensions and running the tests. Then enable them one by one.

I just had the same problem. I also noticed that having Fine Code Coverage enabled causes every test to be run in the background even if you only choose a single test in the Test Explorer.
What seems to work is to enable RunMsCodeCoverage in the Fine Code Coverage settings.

Related

Double wwwroot folder when deploying blazor via devops pipeline

When I publish our blazor server app via Visual Studio to a local folder all is fine. We get a single wwwroot folder with all the css etc in it. However when deployed via Blazor to the server we get the wwwroot folder inside another wwwroot folder for some reason. Does anyone know what could be the issue?
I found the problem and it was a little curious.
Basically I had the following in the csproj file for the client project.
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Content Remove="wwwroot\css\bootstrap-select.css" />
<Content Remove="wwwroot\css\bootstrap-select.min.css" />
<Content Remove="wwwroot\css\bootstrap-theme.css" />
<Content Remove="wwwroot\css\bootstrap-theme.min.css" />
<Content Remove="wwwroot\css\bootstrap.css" />
<Content Remove="wwwroot\css\bootstrap.min.css" />
<Content Remove="wwwroot\css\cust-bootstrap.css" />
<Content Remove="wwwroot\css\cust.css" />
<Content Remove="wwwroot\css\navbar.css" />
<Content Remove="wwwroot\css\site.css" />
</ItemGroup>
<ItemGroup>
<None Include="wwwroot\css\bootstrap-select.css" />
<None Include="wwwroot\css\bootstrap-select.min.css" />
<None Include="wwwroot\css\bootstrap-theme.css" />
<None Include="wwwroot\css\bootstrap-theme.min.css" />
<None Include="wwwroot\css\bootstrap.css" />
<None Include="wwwroot\css\bootstrap.min.css" />
<None Include="wwwroot\css\custbootstrap.css" />
<None Include="wwwroot\css\cust.css" />
<None Include="wwwroot\css\navbar.css" />
<None Include="wwwroot\css\site.css" />
<None Include="wwwroot\img\navbarlogo.png" />
<None Include="wwwroot\js\bootstrap-select.min.js" />
<None Include="wwwroot\js\bootstrap.js" />
<None Include="wwwroot\js\bootstrap.min.js" />
<None Include="wwwroot\js\references.js" />
<None Include="wwwroot\js\site.js" />
<None Include="wwwroot\static\master.html" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.1.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.1" PrivateAssets="all" />
<PackageReference Include="PSC.Blazor.Components.Tabs" Version="1.0.6" />
I Noticed that one of my other Blazor projects did not have these in. I removed the wwwroot entries from this file and it fixed the double folder issue.
I have no idea how they got into the project file in the first place...

Specflow+ Xunit Running every case twice in visual studio

I am using specflow with xunit and i am facing the issue as if i right click and run one selenium test case from the test explorer, all the other test cases also runs and both run twice.
i have installed the following dependencies:
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.5.0" />
<PackageReference Include="DotNetSeleniumExtras.WaitHelpers" Version="3.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="17.0.0" />
<PackageReference Include="MongoDB.Driver" Version="2.14.1" />
<PackageReference Include="Selenium.WebDriver" Version="4.1.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="96.0.4664.4500" />
<PackageReference Include="SpecFlow.Plus.LivingDocPlugin" Version="3.9.57" />
<PackageReference Include="FluentAssertions" Version="6.2.0" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.9.40" />
<PackageReference Include="SpecFlow.xUnit" Version="3.9.40" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.assert" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
i have tried removing packages folder from users/nuget folder and build again but that also did not helped..
However i did not faced this problem with Nunit
SpecFlow.Plus.LivingDocPlugin is a plugin for Specflow not Xunit. If you need to use both Specflow plus and Xunit you should also include the main Specflow libraries needed to interface with Xunit.
SpecFlow
SpecFlow.xUnit
SpecFlow.Tools.MsBuild.Generation

Exception when Scaffold-DbContext with IBM.EntityFramework

When using the command in the package manager console window in VS2017 Professional
Scaffold-DbContext "server=server;uid=username;pwd=password;database=database" IBM.EntityFrameworkCore -force
With these dependencies:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IBM.EntityFrameworkCore" Version="1.3.0.100" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.4" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.2.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
I'm encountering the following exception:
System.MissingMethodException: Method not found: 'Void Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpDbContextGenerator..ctor(Microsoft.EntityFrameworkCore.Scaffolding.IScaffoldingProviderCodeGenerator, Microsoft.EntityFrameworkCore.Design.IAnnotationCodeGenerator, Microsoft.EntityFrameworkCore.Scaffolding.Internal.ICSharpUtilities)'.
at IBM.EntityFrameworkCore.Scaffolding.Internal.Db2CSharpDbContextGenerator..ctor(IScaffoldingProviderCodeGenerator providerCodeGenerator, IAnnotationCodeGenerator annotationCodeGenerator, ICSharpUtilities cSharpUtilities)
It should be noted that there is another project in the same solution also using EntityFramework Core for SQL Server that is generating the DB Context fine with the Scaffold-DbContext command.

Visual Studio 2017 mistakenly thinks EF 6 is installed

I upgraded my ASP.NET Core, EF Core class library solution to Visual Studio 2017.
However when I want to run migrations commands like Add-Migration I get the following warning.
Both Entity Framework Core and Entity Framework 6 are installed. The Entity Framework Core tools are running. Use 'EntityFramework\Update-Database' for Entity Framework 6.
However I don't have EF 6 installed
My csproj
...
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.1" />
<PackageReference Include="System.Collections" Version="4.3.0" />
<PackageReference Include="System.Linq" Version="4.3.0" />
<PackageReference Include="System.Runtime" Version="4.3.0" />
<PackageReference Include="System.Threading" Version="4.3.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project>
This can happen if you previously had an EF6 project open in VS. To unload EF6, you can use the following command.
Remove-Module EntityFramework

Unable to generate model from database in Visual Studio 2017 RC

I followed the official Microsoft tutorial for Entity Framework Core database first approach available in this link.
When I try to execute the below command to generate the model from the database:
Scaffold-DbContext "Server=Data Source=DESKTOP-COJD62N;Initial Catalog=TrainGameDB;Integrated Security=True" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -context TrainGameContext -Verbose
I am getting the following output:
Build started...
Build succeeded.
dotnet exec needs a managed .dll or .exe extension. The application specified was 'F:_IIT Level 6\UX\CW2 Backend\App2\TrainGameAPI\src\TrainGameAPI\bin\Debug\netcoreapp1.0\TrainGameAPI.runtimeconfig.json'
Process finished with non-zero exit code
I am using:
Visual Studio 2017 RC
SQL Server 2016 Developer
.NET Core 1.1.0 (I uninstalled version 1.0.1 and installed this)
ASP.NET Core Web API Application
Windows 10 Education
Here is the list of packages from my .csproj file (VS 2017 doesn't have a package.json file)
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0-preview4-final" />
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.0.0" />