Page 1 of 1
Cannot Execute Single Steps using “Run Selected” due to mscorlib.dll Compile Error
Posted: Wed Mar 04, 2020 11:13 pm
by Balash
I’m building a project in .Netframework 4.7.2 with various nuget packages installed. If I compline and run the entire test suite, the project compline and execute correctly. But when I attempt to execute a single step, using run selected, in a project I get the following compile error:
Code: Select all
Compile Error:An assembly with the same identity 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' has already been imported. Try removing one of the duplicate references. - C:\Users\xxxx\Automation\xxx\xxx\bin\Release\CreatingLibrary.Runner.exe
I check the box “do not reference mscolib.dll” under compline option but that didn’t make a difference.
Re: Cannot Execute Single Steps using “Run Selected” due to mscorlib.dll Compile Error
Posted: Thu Mar 05, 2020 12:30 pm
by odklizec
Hi,
It's most probably caused by one of the nuget packages? Have you tried what's suggested in the error...
Try removing one of the duplicate references
Eventually, try to remove individual packages (one by one) to find which one is causing this issue.
BTW, in case you are using multiple projects, make sure that all of them target the same .Net version (project Settings >> Compiling tab)!
Re: Cannot Execute Single Steps using “Run Selected” due to mscorlib.dll Compile Error
Posted: Thu Mar 05, 2020 11:42 pm
by Balash
Hi Pavel,
Thanks for your reply.
- The project, in its entirety, complies and runs without a problem. So it appears that the main project file doesn't contain duplicate references. I'm assuming, a temperately project files is dynamically generated to facilitate the build of a module or a step. That's a generated file so I cannot modify or remove duplicate references from that file.
- Why should all projects target the same .Net version as long as the specific version of the .Net framework is installed on the machine?
Regards,
Balash
Re: Cannot Execute Single Steps using “Run Selected” due to mscorlib.dll Compile Error
Posted: Fri Mar 06, 2020 3:37 am
by Balash
I found, at least, a temporary fix.
The issue, as the error message indicated, was that mscorlib.dll gets referenced twice due to, what I assume, a bug in Ranorex. It took a while to figure where those references were.
mscorlib.dll gets referenced twice :
Once in
And then again in:
- [projectname].rxsln (which is generated by Ranorex)
Under
Project --> Project options --> Compile [tab] there is checkbox that has the option:
Do not reference mscorlib.dll
This checkbox doesn’t seem to work. So the only option was to remove the reference from the mail project file by deleting:
<Reference Include="mscorlib" />
Regards,
B
Re: Cannot Execute Single Steps using “Run Selected” due to mscorlib.dll Compile Error
Posted: Fri Sep 18, 2020 9:59 am
by RazvanH
Hi everyone,
I have the same problem here, I was able to solve it with @Balash's solution - by editing the * .csproj file.
Thanks for that Balash.
Re: Cannot Execute Single Steps using “Run Selected” due to mscorlib.dll Compile Error
Posted: Tue Sep 29, 2020 8:51 pm
by cslegna
I ran into the same issue after importing a NuGet package for the first time, and I too was able to get around it by commenting out the reference to mscorlib in my .csproj (thanks Balash). Any word on a fix for this?
Re: Cannot Execute Single Steps using “Run Selected” due to mscorlib.dll Compile Error
Posted: Thu May 12, 2022 6:40 pm
by asisharavind
Can someone please help me on which .cs file needs to be changed. I mean the location of the file. I ran into the same issue.
Re: Cannot Execute Single Steps using “Run Selected” due to mscorlib.dll Compile Error
Posted: Fri May 13, 2022 8:09 am
by odklizec
Re: Cannot Execute Single Steps using “Run Selected” due to mscorlib.dll Compile Error
Posted: Fri May 13, 2022 4:17 pm
by asisharavind
Yes i tried the below steps . But it is not working even after checking the box 'Do not reference mscorlib.dll'
Under
Project --> Project options --> Compile [tab]
Moreover i also tried to remove mscorlib from references folder and that also didn't help.
Re: Cannot Execute Single Steps using “Run Selected” due to mscorlib.dll Compile Error
Posted: Mon May 16, 2022 7:00 am
by odklizec
Hi,
Have you physically checked .rxsln and .csproj files if the mscorlib reference is removed?
Re: Cannot Execute Single Steps using “Run Selected” due to mscorlib.dll Compile Error
Posted: Thu May 19, 2022 7:44 pm
by asisharavind
Yes thats right..And the error is displayed only when i'm trying to run a test case using the RUN CODE button (inside the test case). If I run the same test case from rxtst file, it runs successfully.
Re: Cannot Execute Single Steps using “Run Selected” due to mscorlib.dll Compile Error
Posted: Fri Aug 26, 2022 12:41 pm
by pattatha9
I have the same problem here, I was able to solve it with @Balash's solution - by editing the * .csproj file.
19216811.bid
panoramacharter.ltd
Re: Cannot Execute Single Steps using “Run Selected” due to mscorlib.dll Compile Error
Posted: Thu Sep 08, 2022 4:59 pm
by Baxter
This is definetly a bug with Ranorex. you can simply remove the reference in your project, which gets added automatically when you add certain nuget packages I guess ( i was adding system.data.sqlclient package):