I have created .net standard 2.1 class library project with specflow and selenium implementation. I have only added simple login tests in order to have POC that it is working. This is info from json file.
I've added Microsoft.NET.Test.Sdk package, that didn't solved my problem. I've added Microsoft.TestPlatform.TestHost, that didn't solved my problem either.
I'm a beginner so I'm not quite sure what else I need to post here in order to get some help which is more than welcome. I can provide additional info if needed, thanks in advance guys.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<OutputType>Library</OutputType>
</PropertyGroup>
<ItemGroup>
<SpecFlowObsoleteCodeBehindFiles Remove="SharedFeatures\Login.feature.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BoDi" Version="1.5.0" />
<PackageReference Include="Cucumber.Messages" Version="6.0.2" />
<PackageReference Include="DotNetSeleniumExtras.WaitHelpers" Version="3.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="16.9.1" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="Selenium.Chrome.WebDriver" Version="85.0.0" />
<PackageReference Include="Selenium.Support" Version="3.141.0" />
<PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="89.0.4389.2300" />
<PackageReference Include="SpecFlow" Version="3.7.38" />
<PackageReference Include="SpecFlow.NUnit" Version="3.7.38" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.7.38" />
</ItemGroup>
<ItemGroup>
<Compile Update="SharedFeatures\Login.feature.cs">
<DependentUpon>%(Filename)</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<SpecFlowFeatureFiles Update="SharedFeatures\Login.feature">
<Visible>$(UsingMicrosoftNETSdk)</Visible>
<CodeBehindFile>%(RelativeDir)%(Filename).feature$(DefaultLanguageSourceExtension)</CodeBehindFile>
</SpecFlowFeatureFiles>
</ItemGroup>
</Project>
This is the error I'm getting :
Unable to find C:PATH\bin\Debug\netstandard2.1\testhost.dll. Please publish your test project and retry.
Unable to find C:PATH\bin\Debug\netstandard2.1\testhost.dll. Please publish your test project and retry.
A test project can't be .NET Standard. .NET Standard is an API specification and not a runtime/platform. There could be and will be probably different behavior for .NET Framework and .NET Core for the same API.
More details about this at the explanation from xUnit: https://xunit.net/docs/why-no-netstandard
To solve your problem, please select the real target framework. As you have now .NET Standard 2.1, this should be probably .NET Core 3.0 or later.
So it should look like this:
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<OutputType>Library</OutputType>
</PropertyGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With