The assembly or module 'System.Data.SqlServerCe' was not found [duplicate] - mstest

This question already has answers here:
MSTest cannot find the assembly
(4 answers)
Closed 2 years ago.
I have an automation test suite in Visual Studio 2012, using MsTest.
I can successfully run test via Visual Studio using MsTest and Resharper.
But when I try to run my MsTests via command prompt the following error is returned:
Run has the following issue(s):
Warning: Test Run deployment issue: The assembly or module 'System.Data.SqlServerCe' directly or indirectly referenced by the test container 'c:\project.dll' was not found.
To fix this I have tried:
Adding System.Data.SqlServerCe reference to my project.
Setting the reference setting 'Copy Local' = True
Edited my file: vstest.executionengine.x86.exe with
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="System.Data.SqlServerCe" fullName="System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</assemblyBinding>
Also Edited my app.config to incude the same assemblyBinding as above.
None of these worked. So this error is only seen when I try to run my tests via command prompt.
Any thoughts folks?

I will answer my own question here:
It turned out that the warning above was not my issue. When I went back to VS Resharper settings and ticked the checkbox for legacy, I started to get the same error as Mstest via CMD.
But the error message was more detailed in this view. And basically I had to add all relevant DLL's (Ranorex in this case) to the GAC one by one until the error stopped occurring.
Eg. GAC command:
C:\Program Files (x86)\Microsoft Visual Studio 11.0>gacutil /i "C:\ThirdPartyTools\Ranorex\Ranorex.Core.dll"

Related

Error while building SSIS project using MSBuild during CI/CD implementation

Can someone assist with the following error which i am getting while building SSIS project using msbuild. I am having Visual studio 2015 in the machine. Using MSBuild 14.0
"*
error MSB4041: Th e default XML namespace of the project must be the
MSBuild XML namespace. If the project is authored in the MSBuild 200 3
format, please add
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the
element. If the proje ct has been authored in the old 1.0 or
1.2 format, please convert it to MSBuild 2003 format.
*"
I have gone through some articles online but couldn't find solution with this scenario.
*" I have gone through some articles online but couldn't find solution with this scenario.
I'm afraid the answer is negative. For now this scenario(build SSIS project using msbuild) is not supported.
Someone has post this issue in DC forum, see Support SSIS, SSRS, SSAS in MSBuild. So if you're trying to use azure devops for CI/CD process, please vote and track this issue to get notifications when there's any update. And if you're using other tools for CI/CD process, I suggest you open a new feature request to support SSIS building for stand-alone msbuild tools in local machine.
And here're two workarounds which may help:
1.Since you have VS2015 installed, instead of msbuild command, you can try using devenv command.
For VS2015, we can find devenv.exe and devenv.com in path C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE. Both devenv.exe and devenv.com works for this, but note: Using devenv.exe directly prevents output from appearing on the console.
So devenv.xxx ... xxx.dtproj /build can work to build the SSIS project.
2.We can find binary(Microsoft.SqlServer.IntegrationServices.Build.dll) of the SQL Server Data Tools in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE. Then we can use msbuild UsingTask element to call the tasks defined in that assembly.
The core is to call DeploymentFileCompilerTask task for SSIS build in our custom msbuild target after defining this statement:
<UsingTask TaskName="DeploymentFileCompilerTask" AssemblyFile="C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\Microsoft.SqlServer.IntegrationServices.Build.dll" />
More details please refer to here and here.
Update:
If we have several Database projects and SSIS projects in same solution. Using command like devenv.com xx.dtproj directly will actually build all projects.
So I suggest we use command in this way:
Open Developer command prompt for VS
cd to solution directory
use command: devenv.com SolutionName.sln /Build Development /Project SolutionName\xxx.dtproj /ProjectConfig Development
This will only build the SSIS project actually.
In addition: If you see the message The project 'DatabaseProjectName.sqlproj' will close once model building has paused. If it doesn't affect your build, just ignore it. After my check if won't actually build Database project(the output of database project is empty) if we use command above.

No tests found to run - while debugging/running Unit test cases -- Visual studio 2017 15.5.1

Error : No tests found to run - while debugging/running C# Unit test
cases -- Visual studio 2017 15.5.1 not discovering test cases.
Framework
Microsoft.NET framework 4.6.1
Added Test adapters as below
MSTest.TestAdapter.1.2.0
MSTest.TestFramework.1.2.0
Test explorer not showing the test cases.
This started happening after upgrading visual studio.
Some unit test projects test cases do not get discovered in the test explorer.
When try to debug or run it says "No tests found to run."
I tried deleting project and recreating it again .. but didn't worked.
Output
[4/3/2018 2:59:25 PM Informational] No tests found to run.
I have updated VS to 15.6.4
Deleting VS test cache files DEL %TEMP%\VisualStudioTestExplorerExtensions
Restarted Visual studio
Test cases got discovered but not debugging
Problem
If I understand you correctly, this is something you observe:
when you run the tests, the following can be seen in the console:
[4/3/2018 2:26:13 PM Informational] ------ Run test started ------
[4/3/2018 2:26:14 PM Warning] No test is available in d:\...\UnitTestProject1.dll. Make sure that test discoverer & executors are
registered and platform & framework version settings are appropriate and try
again.
and the test explorer shows:
What could have happened, and it happened to me a couple of times, that the test discovery is set up for another architecture than your currently set one.
Example
Your current configuration is x64
but, the default test settings might have another one (e.g. x86):
Solution
If you _align the test settings with your current architecture (x86 → x64), the tests should run.
Manual cleanups should not be necessary nowadays, if the solution is configured consistently
I had same problem, make sure you set TestClass to public !
[TestClass]
public class CSharp_JavaScript_ServerResponse_Test
{
}
I had may versions of the Nuget Package installed, I consolidated them into the latest one and it fixed the problem
MSTest.TestAdapter
MSTest.TestFramework
As of today, me using NUnit # VSCode and .NET Core 5.0
was missing Microsoft.NET.Test.SDK NuGet package..
As soon as I added it to ALL test assemblies (i.e.: all .csproj files in solution .sln), everything works fine.
HTH to many who reach this far.
These PackageReferences are in my TestProject.csproj
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.1"/>
<PackageReference Include="NUnit.Console" Version="3.12.0"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0-beta.2"/>
<PackageReference Include="NUnitTestAdapter" Version="2.3.0"/>
<PackageReference Include="NUnit.Extension.NUnitProjectLoader" Version="3.6.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0-release-20210422-02"/>
</ItemGroup>
The accepted answer didn't work for me in isolation but along with this it did:
Exit MSVS
Delete the .vs folder (you may lose a few settings related only to that solution)
Restart MSVS
From the accepted answer, ensure the Test -> Settings -> Def Arch-> matches the code
Load playlist (if applicable)
Build
Test!
Try clearing temp files located in the %TEMP% directory
Delete folder : VisualStudioTestExplorerExtensions in %temp% directory.
Note: This path is generally at C:\Users\(yourusername)\AppData\Local\Temp
In my case, "Build -> Clean Solution" did the trick.
Also, make sure you have both MSTest.TestFramework AND MSTest.TestAdapter Nuget packages installed
Guys
I was having the same problem, and fix it by adding the [TestClass] and [TestMethod], and got my Selenium Automated test library working on VS 2015.
Cheers,
[TestClass]
public class GigHubAutomatedTest
{
[TestMethod]
public void StartApplication()
{
using(IWebDriver googleDriver = new ChromeDriver())
{
// 1. Maximize the browser
googleDriver.Manage().Window.Maximize();
googleDriver.Navigate().GoToUrl("https://www.google.com/");
}
}
}
I did below thing and it resolved my problem
I have updated VS to latest version 15.6.4
Deleting VS test cache files DEL %TEMP%\VisualStudioTestExplorerExtensions
Restarted Visual Studio
Then test cases got discovered but not debugging.
It was giving error as:
Dependency finder domain): Loaded 'C:\PROGRAM FILES (X86)\MICROSOFT
VISUAL
STUDIO\2017\ENTERPRISE\COMMON7\IDE\EXTENSIONS\TESTPLATFORM\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll'.
Cannot find or open the PDB file.
and similar error for other DLLs as below:
C:\PROGRAM FILES (X86)\MICROSOFT VISUAL
STUDIO\2017\ENTERPRISE\COMMON7\IDE\EXTENSIONS\TESTPLATFORM\Microsoft.VisualStudio.TestPlatform.Common.dll'.
Cannot find or open the PDB file.
So PDB is a debug information file used by Visual Studio. These are system DLLs, which you don't have debug symbols for.
Go to Tools->Options->Debugging->Symbols and select checkbox "Microsoft Symbol Servers", Visual Studio will download PDBs automatically.
Then I downgraded:
MSTest.TestAdapter.1.2.0 to 1.1.18
MSTest.TestFramework.1.2.0 to 1.1.18
Then restarted VS studio and rebuild.
Still got below error:
System.IO.FileNotFoundException: Could not load file or assembly
'System.Net.Http, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
system cannot find the file specified.
Then I set version to newVersion="4.0.0.0"
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.0.0.0" />
</dependentAssembly>
And it started debugging.
My issue was I was using async-await, and the return type was void. It needs to be Task.
Changed this:
public async void MyTest()
To this:
public async Task MyTest()
You can get this error message if you make the mistake of right-clicking inside the editor then choosing Debug Test(s) when you are NOT in a unit test method (e.g. you have a method Foo() and you put a breakpoint in there and want to run the tests so they cause the breakpoint to be hit...nothing will happen if you choose Debug Test(s) while inside the body of Foo()...you have to go to Test Explorer and choose Debug or use the shortcut Ctrl+T,Ctrl+R).

Visual Studio Web Site ": Build (web): The file name already in the collection"

I'm working on a web site (not web application) project in Visual Studio 2013 and have intermittent build issues. The build output shows each directory building (e.g. "Building directory '/User/'."). However, more often than not, on different directories, during different build attempts, I receive the following error (note the filename changes):
The file name 'C:\Users\xxxx\AppData\Local\Temp\2\Temporary ASP.NET Files\root\25143ee9\2d39f4f7\yhzrc1w3.pdb' was already in the collection. Parameter name: fileName
And the following build output:
: Build (web): The file name 'C:\Users\xxxx\AppData\Local\Temp\2\Temporary ASP.NET Files\root\25143ee9\2d39f4f7\yhzrc1w3.pdb' was already in the collection.
I have tried deleting everything from the temp directories, restarting visual studio, bypassing Visual Studio (building with aspnet_compiler), and doing a rain dance. However, no matter what I try builds intermittently fail.
Is there any way to see more granular output from the build process in Visual Studio? I've already tried setting the build output to detailed ("Tools"-->"Projects and Solutions"-->"Build and Run"-->"MSBuild project build output verbosity:"). Any ideas would be greatly appreciated!
Thank you!
I ended up finding out what was causing the problem.
I had upgraded from ReportViewer 10 to ReportViewer 11 and the following line was added to the web.config:
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</buildProviders>
This was causing the intermittent build failures. I removed the buildProvider tag and it builds and deploys just fine.

QualityToolsPackage failed to load in build?

I am using Bamboo [from Altassian] and it uses the devenv.com builder to build solution files. Currently, I seem to be getting a "false" error in my builds - that I've tried to solve by myself but just can't - so I thought I would ask.
Each build succeeds normally - without errors stemming from code - but seems to instead give this error
Package 'Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage, Microsoft.VisualStudio.QualityTools.TestCaseManagement, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed to load.
I've no idea why this is causing problems in the devenv.com environment and I can't figure out either how to "ignore" this error by some build command?
Try this ( from MSFT support )
Can you check if the dll is in the global assembly cache (open a VS 2010 command prompt
(Start | All Programs | Microsoft Visual Studio 10.0 | Visual Studio Tools))
Type in
Gacutil –l > list.txt
Notepad list.txt
Do you see an entry like
Microsoft.VisualStudio.QualityTools.TestCaseManagement, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
If so, from the same command prompt, run fuslogvw, go to settings, select log bind failures to disk, select ok
Run your command line
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com /Build "Release|Mixed Platforms" "D:\Builds\19\Test VizXView\VizXView v1.8 Test Release Build - Weekly\Sources\VizXView v1.8\VizXView 1.8.sln"
Click on the refresh button in fuslogvw. Do we get any bind errors?
I had a similar issue related to running unit tests on a build server that was using devenv.exe (not devenv.com). I had a premium VS installed on the build server but I'd written the unit tests with ultimate (which 'has' load testing, even tho I'd not used it). I used fusion viewer to work out that the missing dll was LoadTest.dll which I copied from my laptop to the buildserver, I also removed references in my solution that were in version control to: *.vsmdi and *.testsettings (they're deprecated) and I removed from the build def a reference to a .testsettings file.
My guess would be that even though I wasn't running a load unit test the build agent was trying to load the LoadTest libs just in case. Hope that helps
edit ---
ok, my own problem here was that I've got both vs2010 and vs2013 on my laptop. When I added the first test project to my VS2010 solution, the project added actually has a dependency on the 2013 version of the UnitTestFramework.dll. My build server only has vs2010 on it so I got the missing assembly error. Switching the reference to the 2010 version fixed this.

Visual Studio Test won't run over a network share

When I try to run my test suite, which works fine under Visual Studio 2008, I get the following error in the Output window:
Error loading J:\VBProjects2010\Libraries\PFTest\PFTest\bin\Debug\PFTest.dll: Could not load file or assembly 'file:///J:\VBProjects2010\Libraries\PFTest\PFTest\bin\Debug\PFTest.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
Note that these same tests can be viewed in the Test View windows, and run well under Visual Studio 2008, but fail only under VS2010.
Note that PFTest.dll is the test project's name, and the dll is the file created when I compile (which compiles ok).
strong textIn addition to the above, I realised I could not step through code either since the compiled dlls and exe could not be loaded from the shared drive.
This solved the problem.
Edit C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config
Add <loadFromRemoteSources enabled="true"/> under <runtime> so that it looks like this:
<runtime>
<loadFromRemoteSources enabled="true" />
<UseSmallInternalThreadStacks enabled="true" />
...
The gouderadrian's anwser did not worked for me.
I am on a VirtualBox machine with Windows 7 64 bits and Visual Studio 2012.
I had to move the output to a local folder : open the unit tests project properties and in the Build tab, browse the Output path to a local folder. The tests are now detected and can be run.
For Visual Studio 2010 Express for Windows Phone the file you're looking for has the name VDPExpress.exe.config.
MS's docs here: http://msdn.microsoft.com/en-us/library/dd409252.aspx

Resources