Skip to content

Microsoft.Data.SqlClient.SNI.x64 not copied to bin #745

Closed as not planned
Closed as not planned

Description

@LucGosso

Hi there!

Using Team City and Octopus deploy, Microsoft.Data.SqlClient asks for the 64x SNI to work at runtime.

installed nuget Microsoft.Data.SqlClient.SNI.2.1.0, works locally. but in staging it is not copied to bin folder. What am i missing?

in csproj, got only this:

<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')" />

(the package and targets-file is there)
image

using .net 4.7.2, visualstudio 2019, web project

Any ideas?

Activity

  1. changed the title [-]Microsoft.Data.SqlClient.SNI.2.1.0 not copies to bin[/-] [+]Microsoft.Data.SqlClient.SNI.x64 not copied to bin[/+] on Sep 30, 2020
  2. added
    Area\Native SNI
    on Sep 30, 2020
  3. karinazhou commented on Sep 30, 2020

    @karinazhou
    Member

    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,

  4. LucGosso commented on Sep 30, 2020

    @LucGosso
    Author

    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)

  5. karinazhou commented on Sep 30, 2020

    @karinazhou
    Member

    @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.

  6. simongh commented on Dec 18, 2020

    @simongh

    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.

  7. LucGosso commented on Jan 4, 2021

    @LucGosso
    Author

    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')" />

  8. cheenamalhotra commented on Jan 4, 2021

    @cheenamalhotra
    Member

    What maybe happening - what happens for me - is the octopack tasks run before the task to move the SNI files.

    Hi @simongh

    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.

  9. LucGosso commented on Jan 4, 2021

    @LucGosso
    Author

    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 ?

  10. LucGosso commented on Jan 4, 2021

    @LucGosso
    Author

    the weird thing is that all copy commands after CopyRoslynCompilerFilesToOutputDirectory is not included in the package (without nuspec hack), but all before that is...

    image

    any idea why?

    https://stackoverflow.com/questions/19115010/octopack-additional-files-copied-in-a-pre-build-event

  11. simongh commented on Jan 17, 2021

    @simongh

    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

  12. lAnubisl commented on Feb 25, 2021

    @lAnubisl

    Please fix NuGet package

  13. norcisa-andy commented on Mar 3, 2021

    @norcisa-andy

    I have also experienced this issue.

  14. MojoDK commented on Apr 8, 2021

    @MojoDK

    I have this problem too - why is this still not fixed?

  15. tobias76 commented on Apr 19, 2021

    @tobias76

    We are also experiencing this with .NET Framework and WPF. Following for updates.

  16. 1 remaining item

  17. DavoudEshtehari commented on Apr 23, 2021

    @DavoudEshtehari
    Contributor

    Thanks @tobias76 and @Kellen-Stuart we'll give it a try.

  18. kfrancis commented on Dec 3, 2021

    @kfrancis

    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 ?

    This fixed it for me.

  19. JRahnama commented on Jan 12, 2022

    @JRahnama
    Contributor

    @LucGosso is this still an issue?

  20. LucGosso commented on Jan 12, 2022

    @LucGosso
    Author

    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.

  21. Kellen-Stuart commented on Jan 13, 2022

    @Kellen-Stuart

    @JRahnama We are also copying DLLs into the /bin folder manually. Not the way to go, but needed it to work.

  22. kfrancis commented on Jan 20, 2022

    @kfrancis

    @LucGosso is this still an issue?

    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.

  23. AndreasJilvero commented on Jan 20, 2022

    @AndreasJilvero

    @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:

    image

    And it actually works. I could also remove <ContentSNIFiles Condition="'$(RunOctoPack)' != '' And '$(RunOctoPack)'!= 'false'">true</ContentSNIFiles>.

  24. kristianjaeger commented on Jun 7, 2022

    @kristianjaeger

    Any plans to fix this issue? I am hitting this as well.

  25. dimula commented on Jan 18, 2023

    @dimula

    still an issue. Azure CD pipeline doesnt grab SNI files

  26. Aashishkebab commented on Apr 26, 2023

    @Aashishkebab

    still an issue. Azure CD pipeline doesnt grab SNI files

    Did you ever figure this out?

  27. added
    External 🔗
    on Mar 12, 2024
  28. David-Engel commented on Jun 11, 2024

    @David-Engel
    Contributor

    Closing as a likely duplicate of #612.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area\Native SNIExternal 🔗

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions