Dapper Package - Failed to resolve assembly: 'System.Data.Common, Version=0.0.0.0, Culture=neutral, ...'
Hi,
If i install the Dapper package in my c# .Net framework 4.8 version project, i am getting the below error in jenkins. What is the solution for this?
Error:-
- mono Tool_ERAAvevaEntry/packages/altcover.8.8.21/tools/net472/AltCover.exe --reportFormat=OpenCover --attributeFilter=ExcludeFromCodeCoverage --linecover -r Tool_ERAAvevaEntry/_Reports/coverage.xml --outputDirectory=Tool_ERAAvevaEntry/bin/Debug/__Instrumented -i Tool_ERAAvevaEntry/bin/Debug --assemblyExcludeFilter=NUnit3.+ --assemblyExcludeFilter=nunit+ --assemblyExcludeFilter=Microsoft+ ........ ........ ERROR *** Instrumentation phase failed Failed to resolve assembly: 'System.Data.Common, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
I have absolutely no idea; this is a core system package, so there's no reason it should be missing; have you tried adding an explicit reference to System.Data.Common at the application level, i.e. having your executable reference System.Data.Common directly instead of just transitively?
Yes, Tried adding dll directly from this path. Still same issue.
"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.8\Facades\System.Data.Common.dll"
this sounds like a problem in the build/deploy; I'm not sure how I can help with that - I don't know anything about Jenkins, and System.Data.Common isn't my package... I don't even know what the setup is here, in terms of what I would need to do to repro it.
In my solution, i have 2 projects...
One is the main project - .netframework 4.8 - Windows Application (which contains the package Dapper). Another project is the test project - .netframework 4.8 - Class library (which contains Nunit packages Nunit, Nunit Console runner and Nunit3 Test adapter).
I think some conflicts happening between these packages. I dont know how to resolve this.
If we forget about Jenkins for a moment: does the code work as built? If the problem only happens during this instrumentation, then that sounds like a question for the instrumentation tool, but I would try adding --assemblyExcludeFilter=Dapper+ --assemblyExcludeFilter=System.Data+, purely to see if that helps (I've never used this tool, I'm just guessing from the command-line here)
Yes, the code works as built. Only the error happens during the instrumentation. I will try your suggestion.
Tried with the assemblyExcludeFilter, still same issue....
- mono Tool_ERAAvevaEntry/packages/altcover.8.8.21/tools/net472/AltCover.exe --reportFormat=OpenCover --attributeFilter=ExcludeFromCodeCoverage --linecover -r Tool_ERAAvevaEntry/_Reports/coverage.xml --outputDirectory=Tool_ERAAvevaEntry/bin/Debug/__Instrumented -i Tool_ERAAvevaEntry/bin/Debug --assemblyExcludeFilter=NUnit3.+ --assemblyExcludeFilter=nunit+ --assemblyExcludeFilter=Dapper+ --assemblyExcludeFilter=System.Data+ --assemblyExcludeFilter=System.Data.Common+ --assemblyExcludeFilter=Microsoft+
Creating folder /home/jenkins/agent/workspace/Test_Mongoose_feature_US565656/Tool_ERAAvevaEntry/bin/Debug/__Instrumented/ Instrumenting files from /home/jenkins/agent/workspace/Test_Mongoose_feature_US565656/Tool_ERAAvevaEntry/bin/Debug/ Writing files to /home/jenkins/agent/workspace/Test_Mongoose_feature_US565656/Tool_ERAAvevaEntry/bin/Debug/__Instrumented/ Creating folder /home/jenkins/agent/workspace/Test_Mongoose_feature_US565656/Tool_ERAAvevaEntry/_Reports => /home/jenkins/agent/workspace/Test_Mongoose_feature_US565656/Tool_ERAAvevaEntry/bin/Debug/Dapper.dll => /home/jenkins/agent/workspace/Test_Mongoose_feature_US565656/Tool_ERAAvevaEntry/bin/Debug/AvevaEntry.exe => /home/jenkins/agent/workspace/Test_Mongoose_feature_US565656/Tool_ERAAvevaEntry/bin/Debug/NUnit3.TestAdapter.dll => /home/jenkins/agent/workspace/Test_Mongoose_feature_US565656/Tool_ERAAvevaEntry/bin/Debug/ERAAvevaEntry.Test.dll
Coverage Report: /home/jenkins/agent/workspace/Test_Mongoose_feature_US565656/Tool_ERAAvevaEntry/_Reports/coverage.xml /home/jenkins/agent/workspace/Test_Mongoose_feature_US565656/Tool_ERAAvevaEntry/bin/Debug/__Instrumented/NUnit3.TestAdapter.dll
<= NUnit3.TestAdapter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null
/home/jenkins/agent/workspace/Test_Mongoose_feature_US565656/Tool_ERAAvevaEntry/bin/Debug/__Instrumented/Dapper.dll
<= Dapper, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null
Resolved assembly reference 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' as file '/usr/share/dotnet/shared/Microsoft.NETCore.App/5.0.7/System.Data.dll'.
ERROR *** Instrumentation phase failed
Failed to resolve assembly: 'System.Data.Common, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Details written to /home/jenkins/agent/workspace/Test_Mongoose_feature_US565656/Tool_ERAAvevaEntry/bin/Debug/__Instrumented/AltCover-2024-04-26--11-53-39.log
script returned exit code 255
If i remove any one of these package from the project (Nunit console runner or Dapper), then i am not getting the error.