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
Investigate SNI.dll transitive loading in MSIX project #612
Here is a sample solution that tests if Native SNI DLLs are presents. It required SqlLocalDb to be installed (see readme.txt) and only contain .NET FX 4.7.2 projects (Console, WinForms, WPF) that works with ClickOnce and associated MSIX projects which does NOT work yet!
I also tried UWP but it seems that SqlLocalDb is not well supported and SNI DLLs are included by the way.
Please don't forget to 'restore' NuGet packages as the packages are not included in this sample ZIP. TestSNI.zip
Hope you will get a fix quite soon since I plan to migrate my project to .NET Core 3.1 (and MSIX seems to the supported .NET Core alternative to ClickOnce in .NET FX)
The difference between v1.1.3 and v2.0.0 is that we have now included symbols in the SNI runtime packages.
The issue you're facing was also reported in dotnet/sdk#10523, please try adding <IncludeSymbolsInSingleFile>true</IncludeSymbolsInSingleFile> to your project.
Thanks for your reply. I have added that to my .csproj file (both the Windows Packaging Project and the WPF App) but the issue still seems to persist, unless I'm adding it in the wrong place. I'm attaching a sample project which runs when published as a standard WPF app but not when published through the MSIX Packaging project.
I have also experienced this issue with a .NET Core 3.1 WPF Desktop app published using a Windows Packaging Project. When the Windows Packaging Project publishes the required dependencies for the WPF Desktop app, it will pack all of the PDB files into an appxsym package. As far as I can tell, there is no way to instruct the MSIX or APPX installers to unpack the appxsym package into the final installation directory.
Is there a way to use v2.0.0 of the SNI runtime without a dependence on the SNI.pdb? I have also temporarily rolled our code back to v1.1.3 and the WPF Desktop app can deploy and run without issue.
A dirty workaround can be to add SNI DLLs (x86 & x64) in the project as content resources. They will be deployed in the MSIX package and your application will be able to run (and no PDB deployed)! This is a temporary fix that has to be removed until this issue fixed.
I have the same problem described here with my WPF project in .NET Core 3.1. Do you maybe know how your workaround would look like for a .NET Core application (i don't have any packages folder with the dlls you included as content resource...)?
I tried editing WPF csproj this way and it seems to work for me (SNI DLLs are present in the MSIX package but I don't know if it work or not). Please give some feedback:
This is the issue that I ran into before. Even if you add the corresponding pdb files as "Content" as above with the dll files, the MSIX installer will remove all pdb symbol files and place the symbols into a appxsym package. Since the SNI runtime is dependent directly on the pdb files being deployed alongside the application, v2.0.0 and greater will not work with an MSIX installer project.
Until this project is updated to not rely on the pdb symbol files being deployed with the application, I have been using v1.1.3 with little issue with the MSIX installer.
@mrholshi You are true! PDBs are not beeing deployed along the Appx package. Right know I looked at the "microsoft.data.sqlclient.sni.runtime\2.0.1" folder to look for any msbuild target file but I can't see any. So for now I have NO workaround for .net core project (mine does work with .net fx project) :-(
@cheenamalhotra I updated the SqlClient package to 2.1.1 and re-tested to see if this issue has been fixed with .NET Framework/MSIX. It is still not copying the SNI DLLs when I publish locally. Do you have any update on when this will be fixed?
I tried these targets that can be appended with CopySNIFiles in Microsoft.Data.SqlClient.SNI.targets file or directly in .wapproj file, pasting here for reference. Running wapproj in Visual Studio is able to load SNI.xxx.dll properly with these targets:
<!-- Include SNI Targets file in wapproj file to be able to copy SNI files from reference projects -->
<!-- TODO: Please update referenced project version to include correct library version -->
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)\microsoft.data.sqlclient.sni\5.1.0\buildTransitive\net462\Microsoft.Data.SqlClient.SNI.targets" Condition="Exists('$(NuGetPackageRoot)\microsoft.data.sqlclient.sni\5.1.0\buildTransitive\net462\Microsoft.Data.SqlClient.SNI.targets')" />
</ImportGroup>
<!-- You can include these targets directly in wapproj file too -->
<Target Name="CopySNIProjectFiles"
Condition="'$(CopySNIProjectFiles)' != 'false' And
'$(OutDir)' != '' And
Exists('$(OutDir)')"
Inputs="@(SNIFiles)"
Outputs="@(SNIFiles -> '$(OutDir)\%(_TargetAssemblyProjectName)\%(RecursiveDir)%(Filename)%(Extension)')">
<Copy SourceFiles="@(SNIFiles)"
DestinationFiles="@(SNIFiles -> '$(OutDir)\%(_TargetAssemblyProjectName)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="CopySNIAppFiles"
Condition="'$(CopySNIAppFiles)' != 'false' And
'$(LayoutDir)' != '' And
Exists('$(LayoutDir)')"
Inputs="@(SNIFiles)"
Outputs="@(SNIFiles -> '$(LayoutDir)\%(_TargetAssemblyProjectName)\%(RecursiveDir)%(Filename)%(Extension)')">
<Copy SourceFiles="@(SNIFiles)"
DestinationFiles="@(SNIFiles -> '$(LayoutDir)\%(_TargetAssemblyProjectName)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<PropertyGroup>
<PostBuildEventDependsOn>
$(PostBuildEventDependsOn);
CopySNIFiles;
CopySNIAppFiles;
CopySNIProjectFiles;
</PostBuildEventDependsOn>
<BuildDependsOn>
$(BuildDependsOn);
CopySNIFiles;
CopySNIAppFiles;
CopySNIProjectFiles;
</BuildDependsOn>
<PrepareForRunDependsOn>
$(PrepareForRunDependsOn);
CopySNIFiles;
CopySNIAppFiles;
CopySNIProjectFiles;
</PrepareForRunDependsOn>
</PropertyGroup>
I'll try what they suggest next week. The most frustrating thing is that native SNI files are copied to the bin folder when building in Visual Studio but not when using msbuild CLI. If VS is able to figure it out why not msbuild too?
Activity
jeremy-waguet commentedon Jun 23, 2020
Hi @cheenamalhotra
Here is a sample solution that tests if Native SNI DLLs are presents. It required SqlLocalDb to be installed (see readme.txt) and only contain .NET FX 4.7.2 projects (Console, WinForms, WPF) that works with ClickOnce and associated MSIX projects which does NOT work yet!
I also tried UWP but it seems that SqlLocalDb is not well supported and SNI DLLs are included by the way.
Please don't forget to 'restore' NuGet packages as the packages are not included in this sample ZIP.
TestSNI.zip
Hope you will get a fix quite soon since I plan to migrate my project to .NET Core 3.1 (and MSIX seems to the supported .NET Core alternative to ClickOnce in .NET FX)
yosefmah commentedon Jun 23, 2020
We also have the same issue which has started with version 2.0.0 on a .NET Core 3.1 WPF app being deployed via MSIX. It works fine with v1.1.3.
This is the error:
For what its worth, we have the same issue with an EF Core module again only when deployed as an MSIX: dotnet/efcore#21383
cheenamalhotra commentedon Jun 23, 2020
Hi @yosefmah
The difference between v1.1.3 and v2.0.0 is that we have now included symbols in the SNI runtime packages.
The issue you're facing was also reported in dotnet/sdk#10523, please try adding
<IncludeSymbolsInSingleFile>true</IncludeSymbolsInSingleFile>to your project.yosefmah commentedon Jun 24, 2020
Hi @cheenamalhotra
Thanks for your reply. I have added that to my .csproj file (both the Windows Packaging Project and the WPF App) but the issue still seems to persist, unless I'm adding it in the wrong place. I'm attaching a sample project which runs when published as a standard WPF app but not when published through the MSIX Packaging project.
Update: Attaching the sample project.
MsixModuleError.zip
ghoelscher-git commentedon Aug 26, 2020
Good afternoon,
I have also experienced this issue with a .NET Core 3.1 WPF Desktop app published using a Windows Packaging Project. When the Windows Packaging Project publishes the required dependencies for the WPF Desktop app, it will pack all of the PDB files into an appxsym package. As far as I can tell, there is no way to instruct the MSIX or APPX installers to unpack the appxsym package into the final installation directory.
Is there a way to use v2.0.0 of the SNI runtime without a dependence on the SNI.pdb? I have also temporarily rolled our code back to v1.1.3 and the WPF Desktop app can deploy and run without issue.
Thank you!
jeremy-waguet commentedon Aug 28, 2020
@mrholshi
Hi,
A dirty workaround can be to add SNI DLLs (x86 & x64) in the project as content resources. They will be deployed in the MSIX package and your application will be able to run (and no PDB deployed)! This is a temporary fix that has to be removed until this issue fixed.
jeremy-waguet commentedon Aug 29, 2020
@mrholshi
I edited my project csproj this way and I can confirm that SNI DLLs are bundled in the MSIX package and that the app works as expected :
gseketa commentedon Sep 24, 2020
@jeremy-waguet
I have the same problem described here with my WPF project in .NET Core 3.1. Do you maybe know how your workaround would look like for a .NET Core application (i don't have any packages folder with the dlls you included as content resource...)?
Thanks
jeremy-waguet commentedon Sep 24, 2020
@gseketa
I tried editing WPF csproj this way and it seems to work for me (SNI DLLs are present in the MSIX package but I don't know if it work or not). Please give some feedback:
jeremy-waguet commentedon Sep 24, 2020
@gseketa
PDBs files seem to be required as well as requested by 'WpfApp1.deps.json'. Please include them as well the same way I did for DLLs!
When I run the self-signed sample package I got this in the windows event viewer (Application log):
ghoelscher-git commentedon Sep 24, 2020
@jeremy-waguet
This is the issue that I ran into before. Even if you add the corresponding pdb files as "Content" as above with the dll files, the MSIX installer will remove all pdb symbol files and place the symbols into a appxsym package. Since the SNI runtime is dependent directly on the pdb files being deployed alongside the application, v2.0.0 and greater will not work with an MSIX installer project.
Until this project is updated to not rely on the pdb symbol files being deployed with the application, I have been using v1.1.3 with little issue with the MSIX installer.
jeremy-waguet commentedon Sep 25, 2020
@mrholshi You are true! PDBs are not beeing deployed along the Appx package. Right know I looked at the "microsoft.data.sqlclient.sni.runtime\2.0.1" folder to look for any msbuild target file but I can't see any. So for now I have NO workaround for .net core project (mine does work with .net fx project) :-(
gseketa commentedon Sep 25, 2020
@jeremy-waguet & @mrholshi
Unfortunatelly I can confirm that the proposed workaround didn’t work for me and I got the same error. Thank you for your help...
11 remaining items
jeremy-waguet commentedon Oct 30, 2020
@cheenamalhotra Thanks !
gradyal commentedon Nov 12, 2020
@cheenamalhotra, just checking in to see if there is any news on a release timeline for a fix for this with .NET Framework + MSIX projects?
huoyaoyuan commentedon Dec 14, 2020
Also mentioned this issue when using
Microsoft.EntityFrameworkCore.SqlServerwith WinUI 3, which requires Desktop Bridge and msix.It's fixed by adding reference of
Microsoft.Data.SqlClientv2.1.0gradyal commentedon Jan 21, 2021
@cheenamalhotra I updated the SqlClient package to 2.1.1 and re-tested to see if this issue has been fixed with .NET Framework/MSIX. It is still not copying the SNI DLLs when I publish locally. Do you have any update on when this will be fixed?
LevYas commentedon Jun 2, 2021
I have .NET 5 WPF app, and for some reason, MSIX package did not include SqlClient-related libraries. I managed to fix this by creating a publishing profile (self-contained) and using it in the packaging project as described here https://techcommunity.microsoft.com/t5/windows-dev-appconsult/packaging-a-net-core-3-0-application-with-msix/bc-p/2098665/highlight/true#M497
cheenamalhotra commentedon Jan 24, 2023
I tried these targets that can be appended with
CopySNIFilesin Microsoft.Data.SqlClient.SNI.targets file or directly in .wapproj file, pasting here for reference. Running wapproj in Visual Studio is able to load SNI.xxx.dll properly with these targets:Example minimal WPF app for reference: cheenamalhotra/wpf-sqlclient
JakeThurman commentedon Jun 9, 2025
Still hitting this in .NET Framework in 2025 after trying to migrate due to the System.Data.SqlClient deprecation.
colin-baker-lotus commentedon Sep 19, 2025
Us too. There's an explanation of sorts here:
https://learn.microsoft.com/en-us/sql/connect/ado-net/sqlclient-troubleshooting-guide?view=sql-server-ver17
I'll try what they suggest next week. The most frustrating thing is that native SNI files are copied to the bin folder when building in Visual Studio but not when using msbuild CLI. If VS is able to figure it out why not msbuild too?
priyankatiwari08 commentedon Sep 17, 2026
/triage