Open mbakalov opened 3 years ago
Hi @mbakalov
Thanks for the repro. We'll investigate and get back to you soon!
@cheenamalhotra - thank you for a quick response!
I'd worked around this for now by adding the below target to my webapp.csproj:
<Target Name="_CopySNIFilesToWebProjectOutputDir"
AfterTargets="CopySNIFiles"
Condition="'$(WebProjectOutputDir)' != ''">
<Copy SourceFiles="@(SNIFiles)"
DestinationFiles="@(SNIFiles -> '$(WebProjectOutputDir)\bin\%(RecursiveDir)%(Filename)%(Extension)')"/>
</Target>
It works well enough for my scenario, but looking into the Microsoft.WebApplication.targets
file, the correct fix is probably much more complicated.
Thanks again!
I can confirm. I have the exact same issue.
WOW, I experience the same issue and tried the work around mentioned above and it didnt work. Any tips?
@cheenamalhotra - thank you for a quick response!
I'd worked around this for now by adding the below target to my webapp.csproj:
<Target Name="_CopySNIFilesToWebProjectOutputDir" AfterTargets="CopySNIFiles" Condition="'$(WebProjectOutputDir)' != ''"> <Copy SourceFiles="@(SNIFiles)" DestinationFiles="@(SNIFiles -> '$(WebProjectOutputDir)\bin\%(RecursiveDir)%(Filename)%(Extension)')"/> </Target>
It works well enough for my scenario, but looking into the
Microsoft.WebApplication.targets
file, the correct fix is probably much more complicated.Thanks again!
This workaround works for me. Hoping has non-workaround fix soon.
For some reason, this is really biting me now. A number of production pushes now have resulted in failures due to this.
The problem occurs when using VS2022 (msbuild 17) to publish Web Applications using any version of Microsoft.Data.SqlClient, the files are not copied to OBJ folder and then not copied to final target folder.
If using VS2019 it works fine, in VS2019 build log we can see:
CopyAllFilesToSingleFolderForPackage:
Creating directory "obj\Release\Package\PackageTmp".
Copying all files to temporary location below for package/publish:
obj\Release\Package\PackageTmp.
Copying D:\362\s\packages\Microsoft.Data.SqlClient.SNI.1.0.19235.1\build\net46\x64\SNI.dll to obj\Release\Package\PackageTmp\bin\x64\SNI.dll.
Copying D:\362\s\packages\Microsoft.Data.SqlClient.SNI.1.0.19235.1\build\net46\x64\SNI.pdb to obj\Release\Package\PackageTmp\bin\x64\SNI.pdb.
Copying D:\362\s\packages\Microsoft.Data.SqlClient.SNI.1.0.19235.1\build\net46\x86\SNI.dll to obj\Release\Package\PackageTmp\bin\x86\SNI.dll.
Copying D:\362\s\packages\Microsoft.Data.SqlClient.SNI.1.0.19235.1\build\net46\x86\SNI.pdb to obj\Release\Package\PackageTmp\bin\x86\SNI.pdb.
Lines above doesn't exist in VS2022 build logs.
Any updates @cheenamalhotra ?
Thanks
I did find this, and it's at least helped with the situation where IIS express can't deploy because of locked files.
Any update on this? @poychang 's workaround is not working. The only way I can get it to work is on each device after install, to manually copy and paste the x64 and x86 folders with SNI inside it from the debug in the project files to the application folder "C:\Users\Scott\AppData\Local\Apps\2.0\KD9YXEPJ.DKY\5QCR3OCQ.WRY\vent..tion_098ef6a925fa6387_0001.0009_35951381a6b516d2"
for each machine. I need to install this program often enough for this to be a hassle. Any idea how I can streamline it better or find another workaround? Thanks!
The experience is better in newer versions of Microsoft.Data.SqlClient. Try something newer than 1.x.
The experience is better in newer versions of Microsoft.Data.SqlClient. Try something newer than 1.x.
I updated to Microsoft.Data.SqlClient 5.0.0 and Microsoft.Data.SqlClient.SNI 5.0.0 and still the same issue
The experience is better in newer versions of Microsoft.Data.SqlClient. Try something newer than 1.x.
I updated to Microsoft.Data.SqlClient 5.0.0 and Microsoft.Data.SqlClient.SNI 5.0.0 and still the same issue
I just ran the sample repro project from the original author of this post https://github.com/mbakalov/SqlClientSniRepro1 and upgrade the project from .NET Framework 4.6.1
to 4.6.2
since M.D.S 5.0 only support 4.6.2 and above and ran the
msbuild /t:Build /p:Configuration=Release /p:Platform="Any CPU" Example.sln /p:OutDir=C:\temp\output
and the SNI.dlls (i.e. Microsoft.Data.SqlClient.SNI.x64.dll
, Microsoft.Data.SqlClient.SNI.x86.dll
and along with their pdbs) were copied into the output folder.
@Scott-VentsUS are you able to provide a different repro sample as the one provided from the original author works fine.
Just came across this issue and I can still reproduce it using the reproduction repo and the VS2022 build toolchain.
@lcheunglci I can see the files are copied to the build output folder as you mention, but the OP stated that they were actually copied there, they're missing from the published website folder though, in the _PublishedWebsites\WebApp\bin
subdirectory. Do you mean that location in your comment?
@cheenamalhotra any progress on this issue? Are you waiting for anything?
Since v2, such files are not copied to folders x64/x86 anymore but directly into bin instead.
So if you are upgrading v1, try the app instead of just checking if such folders were created. I have successfully upgraded to v5.
It worth checking breaking changes in that link.
If sticking to v1, this workaround should get files copied:
<Target Name="_CopySNIFilesForPublishPackage"
AfterTargets="CopyAllFilesToSingleFolderForPackage">
<Copy SourceFiles="@(SNIFiles)"
DestinationFiles="@(SNIFiles -> '$(_PackageTempDir)\bin\%(RecursiveDir)%(Filename)%(Extension)')"/>
</Target>
Background
For ASP.NET Web Applications it is common to build them providing
/p:OutDir=someDir
(or/p:OutputPath=someDir
) parameter and then taking the_PublishedWebsites\WebApp
contents and xcopy-ing them.The custom SNI-deploying targets do support
OutDir
but not for a web app scenario - the SNI .dlls don't get copied to_PublishedWebsites\WebApp\bin
.Steps to reproduce
A repo with a blank ASP.NET Web App and steps to reproduce: https://github.com/mbakalov/SqlClientSniRepro1
To reproduce, in VS command prompt do:
The SNI .dlls get copied to
C:\temp\output
, but not toC:\Temp\output\_PublishedWebsites\WebApp\bin
Expected behavior
Expected the SNI .dlls to be copied to the "bin" folder of the published website.
Further technical details
Microsoft.Data.SqlClient version: 2.1.1 .NET target: net461
Related issue: https://github.com/dotnet/SqlClient/issues/441