You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Microsoft.Data.SqlClient.SNI.x64 not copied to bin #745
When you mention "installed nuget Microsoft.Data.SqlClient.SNI.2.1.0, works locally", does the issue happen when you deploy your application through Team City and Octopus? The Microsoft.Data.SqlClient.SNI nuget package contains the native SNI.dll. If the application can work locally but is not deployed successfully, it may be due to the way how the deployment tool handle native dlls.
And is your application the WebForms app? We have the known issue about native SNI.dll loading with WebForms #446 and #727 . Could you please provide a standalone repo application so we can test it locally?
@LucGosso yeah, VS works for you because the nuget.exe solves the native SNI dependency for your application based on the SNI targets file. I am afraid that we have limited knowledge about how the TeamCity and Octopus deploy tool supports native libraries.
The Microsoft.Data.SqlClient nuget package has the dependency of Microsoft.Data.SqlClient.SNI nuget package. The former is the managed library while the latter is the native library. One thing you can also try is to add Microsoft.Data.SqlClient as direct reference to your application and see how it works. If you have already done this, please ignore it.
What maybe happening - what happens for me - is the octopack tasks run before the task to move the SNI files. You mention using Octopus & TeamCity. We use the OctoPack package which adds a task to the build to create packages deployable by Octopus. This task runs before the tasks to copy the SNI files. It therefore means the SNI files are missing from the deploy package.
I haven't so far been able to make the build work. One way around it is to modify your nuspec to manually reference the SNI files.
or it is something in Microsoft.Data.SqlClient.SNI.targets, some environment condition not copying the files, any idea what? hard to debug... <Import Project="..\..\packages\Microsoft.Data.SqlClient.SNI.2.1.0\build\net46\Microsoft.Data.SqlClient.SNI.targets" Condition="Exists('..\..\packages\Microsoft.Data.SqlClient.SNI.2.1.0\build\net46\Microsoft.Data.SqlClient.SNI.targets')" />
Could you capture Binlog file and provide us here by running msbuild with /bl flag (please try for a non-confidential app only).
So we can see the order to execution and address that if possible.
the weird thing is that all copy commands after CopyRoslynCompilerFilesToOutputDirectory is not included in the package (without nuspec hack), but all before that is...
Yea, without doing something - it's still an issue. Rather annoying one too because generally it works on development but fails to copy in deploy situations.
@Kellen-Stuart I had the same issue, and while a combination of @simongh 's nor @LucGosso 's solution was working-ish, it wasn't perfect (the SNI files was copied to both /bin and the root folder). However, when working locally I noticed that everything seemed to work using the msbuild CLI - so I tried to use Command line parameters instead of using Teamcity's Run Octopack checkbox, like this:
And it actually works. I could also remove <ContentSNIFiles Condition="'$(RunOctoPack)' != '' And '$(RunOctoPack)'!= 'false'">true</ContentSNIFiles>.
Activity
[-]Microsoft.Data.SqlClient.SNI.2.1.0 not copies to bin[/-][+]Microsoft.Data.SqlClient.SNI.x64 not copied to bin[/+]karinazhou commentedon Sep 30, 2020
Hi @LucGosso ,
When you mention "installed nuget Microsoft.Data.SqlClient.SNI.2.1.0, works locally", does the issue happen when you deploy your application through Team City and Octopus? The Microsoft.Data.SqlClient.SNI nuget package contains the native SNI.dll. If the application can work locally but is not deployed successfully, it may be due to the way how the deployment tool handle native dlls.
And is your application the WebForms app? We have the known issue about native SNI.dll loading with WebForms #446 and #727 . Could you please provide a standalone repo application so we can test it locally?
Thanks,
LucGosso commentedon Sep 30, 2020
Yes, you got it right. and yes it may due to how the deployment tools handles native dlls (hmm)
it is an ASP.MVC project, not webforms.
Sorry, cant share this application.
so for now, as a workaround, I included the bin/...x64.dll in project to be able to deploy it with tools...
(for the record, when publishing the solution from VS. the dlls are published to site bin folder, so that works)
karinazhou commentedon Sep 30, 2020
@LucGosso yeah, VS works for you because the nuget.exe solves the native SNI dependency for your application based on the SNI targets file. I am afraid that we have limited knowledge about how the TeamCity and Octopus deploy tool supports native libraries.
The Microsoft.Data.SqlClient nuget package has the dependency of Microsoft.Data.SqlClient.SNI nuget package. The former is the managed library while the latter is the native library. One thing you can also try is to add Microsoft.Data.SqlClient as direct reference to your application and see how it works. If you have already done this, please ignore it.
simongh commentedon Dec 18, 2020
What maybe happening - what happens for me - is the octopack tasks run before the task to move the SNI files. You mention using Octopus & TeamCity. We use the OctoPack package which adds a task to the build to create packages deployable by Octopus. This task runs before the tasks to copy the SNI files. It therefore means the SNI files are missing from the deploy package.
I haven't so far been able to make the build work. One way around it is to modify your nuspec to manually reference the SNI files.
LucGosso commentedon Jan 4, 2021
thats a theory... maybe...
or it is something in Microsoft.Data.SqlClient.SNI.targets, some environment condition not copying the files, any idea what? hard to debug...
<Import Project="..\..\packages\Microsoft.Data.SqlClient.SNI.2.1.0\build\net46\Microsoft.Data.SqlClient.SNI.targets" Condition="Exists('..\..\packages\Microsoft.Data.SqlClient.SNI.2.1.0\build\net46\Microsoft.Data.SqlClient.SNI.targets')" />cheenamalhotra commentedon Jan 4, 2021
Hi @simongh
Could you capture Binlog file and provide us here by running
msbuildwith/blflag (please try for a non-confidential app only).So we can see the order to execution and address that if possible.
LucGosso commentedon Jan 4, 2021
So, the issue was in OctoPack ...
the resolution is to add
<files> <file src="bin\**\*.*" target="bin" /> </files>to your nuspec in solution, which is used to pack the nuget to octopus deploy
also add
<PropertyGroup> <OctoPackEnforceAddingFiles>True</OctoPackEnforceAddingFiles> </PropertyGroup>in csproj...
does this work for ya too @simongh ?
LucGosso commentedon Jan 4, 2021
the weird thing is that all copy commands after CopyRoslynCompilerFilesToOutputDirectory is not included in the package (without nuspec hack), but all before that is...
any idea why?
https://stackoverflow.com/questions/19115010/octopack-additional-files-copied-in-a-pre-build-event
simongh commentedon Jan 17, 2021
I found the way round this was to modify the proj file to make it include the the SNI files when Octopack is running.
<PropertyGroup> <ContentSNIFiles Condition="'$(RunOctoPack)' != '' And '$(RunOctoPack)'!= 'false'">true</ContentSNIFiles> </PropertyGroup>This seemed more reliable than modifying the nuspec file
lAnubisl commentedon Feb 25, 2021
Please fix NuGet package
norcisa-andy commentedon Mar 3, 2021
I have also experienced this issue.
MojoDK commentedon Apr 8, 2021
I have this problem too - why is this still not fixed?
tobias76 commentedon Apr 19, 2021
We are also experiencing this with .NET Framework and WPF. Following for updates.
1 remaining item
DavoudEshtehari commentedon Apr 23, 2021
Thanks @tobias76 and @Kellen-Stuart we'll give it a try.
kfrancis commentedon Dec 3, 2021
This fixed it for me.
JRahnama commentedon Jan 12, 2022
@LucGosso is this still an issue?
LucGosso commentedon Jan 12, 2022
I think we solved it by including the dlls into the repo/project/bin-folder. Which is not the way to go but as a workaround.
Kellen-Stuart commentedon Jan 13, 2022
@JRahnama We are also copying DLLs into the /bin folder manually. Not the way to go, but needed it to work.
kfrancis commentedon Jan 20, 2022
Yea, without doing something - it's still an issue. Rather annoying one too because generally it works on development but fails to copy in deploy situations.
AndreasJilvero commentedon Jan 20, 2022
@Kellen-Stuart I had the same issue, and while a combination of @simongh 's nor @LucGosso 's solution was working-ish, it wasn't perfect (the SNI files was copied to both /bin and the root folder). However, when working locally I noticed that everything seemed to work using the msbuild CLI - so I tried to use Command line parameters instead of using Teamcity's Run Octopack checkbox, like this:
And it actually works. I could also remove
<ContentSNIFiles Condition="'$(RunOctoPack)' != '' And '$(RunOctoPack)'!= 'false'">true</ContentSNIFiles>.kristianjaeger commentedon Jun 7, 2022
Any plans to fix this issue? I am hitting this as well.
dimula commentedon Jan 18, 2023
still an issue. Azure CD pipeline doesnt grab SNI files
Aashishkebab commentedon Apr 26, 2023
Did you ever figure this out?
David-Engel commentedon Jun 11, 2024
Closing as a likely duplicate of #612.