Using firefox geckodriver in ASP.NET Core, I noticed that geckodriver.exe is copied to bin\Debug\netcoreapp2.1, which work fine during debugging. But after publishing, it's not present in bin\Debug\netcoreapp2.1\publish.
So I'm trying to copy it using csproj file with this ItemGroup
<ItemGroup>
<Content Include="$(TargetDir)\geckodriver.exe" CopyToPublishDirectory="Always" />
</ItemGroup>
The file is found, cause when I change the path to $(TargetDir)\geckodriver2.exe I get an error that geckodriver2.exe doesn't exist. But it doesn't copy geckodriver.exe to publish directory.