Page 1 of 1

Ranorex 9.0.0 is giving error while loading Visual Studio Solution

Posted: Sat Oct 19, 2019 5:53 am
by Debarati93
Hi,

I have created a solution in Visual Studio where I have used specflow and other plugins.Also I have created another project in Ranorex 9.0.0 where I have identified all the objects of my application and made an object repository.
I have used that repository project (created in Ranorex) in Visual Studio Solution.
This solution is getting build without any issues in Visual Studio,but whenever I am trying to open this solution in Ranorex it's giving below errors.

1. The 'ResolveComReference' task could not be instantiated from Microsoft.Build.Tasks.Core,Version =15.1.0.0......Could not load file or assembly 'Microsoft.Build,Version =15.1.0.0,....

2. "GenerateAll"task could not be instantiated from "D:\Jenkins20\......\APEDesktop\packages\Specflow2.3.2\tools\specflow.exe".Could not load file or assembly 'Microsoft.Build,Version =15.1.0.0,....

I m using Visual Studio 2017 Professional and .Net Framework 4.7.2

Please provide some solutions,as I have tried couple of solutions from net but none of them worked properly. :cry:

Thanks,
Debarati

Re: Ranorex 9.0.0 is giving error while loading Visual Studio Solution

Posted: Tue Mar 10, 2020 4:09 pm
by emil.lalkovski
Hello, yesterday I upgraded Ranorex Studio from version 9.1 to 9.3 and I cannot no longer build my Test solution receiving the same error. Please provide some information about that. Thanks in advance!

Re: Ranorex 9.0.0 is giving error while loading Visual Studio Solution

Posted: Wed Mar 11, 2020 2:29 pm
by McTurtle
Hello Emil,

Do you have by any chance Visual Studio 2017 and Visual Studio 2019 installed in parallel?
Also, try to install the build tools 15. Get it from this link: Build Tools 15

Does it help?

Regards,
McTurtle

Re: Ranorex 9.0.0 is giving error while loading Visual Studio Solution

Posted: Wed Mar 11, 2020 3:44 pm
by emil.lalkovski
Hello,

First thank for your response. I actually have installed only Visual Studio 2019. I also installed Visual Studio build tools 2019,
but I still cannot build my Ranorex project from the Ranorex Studio and I receive the same errors. I've tried uninstalling Visual Studio and build the project without it, then I receive these two errors as warnings and the build succeeds. Problem is that I need both Ranorex and Visual Studio installed. I've tried with both VS 2019 and 2017, still the same.

These are my errors:

Error MSB4061: The ResolveComReference task could not be instantiated from "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". The file or assembly "Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" or a dependency on it was not found. The system cannot find the specified file.

Error MSB4060: The "ResolveComReference" task was incorrectly declared, incorrectly used or could not be executed at build time. Check the spelling of the task name and assembly name.

Kind regards,
Emil

Re: Ranorex 9.0.0 is giving error while loading Visual Studio Solution

Posted: Wed Mar 11, 2020 3:58 pm
by Stub
Oh, ho, ho, ResolveComReference! I know ALLLLLLL about that annoying error message. I detest MSBuild15 because of it.

Basically you have a COMReference element in your project, because you're added a reference to a COM component. You need to remove that COMReference because .NET Core cannot reference anything COM related.

This has caused soooooooooooooooooooooooo many problems for us here.

Re: Ranorex 9.0.0 is giving error while loading Visual Studio Solution

Posted: Wed Mar 11, 2020 4:01 pm
by Stub
Can't remove the COM reference? Fair enough, that's happened to me too. What I do to work around it is to manually generate the Interop DLL using TLBIMP. What I do is add a pre-build event to my solution which manually generates the Interop DLL, then I add a reference and browse to that Interop.DLL instead of browsing the available COM objects. Hey presto, no more COMReference in my .csproj. Sorted.

Here's an extract directly from my Ranorex v9.3.0 .csproj where I applied this trick. I don't have that version of Ranorex installed, hence the direct XML:

Code: Select all

  <PropertyGroup>
    <PreBuildEvent>"$(TargetFrameworkSDKToolsDirectory)TlbImp.exe" "C:\WINDOWS\SysWow64\YourThing.tlb" /out=$(IntDir)Interop.YourThing.dll /namespace=YourThing</PreBuildEvent>
  </PropertyGroup>
I started having this COMReference problem when I tried upgrading to Ranorex v9.3.0. I do NOT have this issue with Ranorex v9.2.1 which I am currently using because of a presently insurmountable issue with Ranorex v9.3.0.

Re: Ranorex 9.0.0 is giving error while loading Visual Studio Solution

Posted: Wed Mar 11, 2020 4:08 pm
by Stub
Our build system is randomly struck by this issue. It's like our MSBuild system mostly always uses the full .NET Framework version of MSBuild, and COMReferences work just fine. But very occasionally it decides to use .NET Core instead, where there is no support for COMReference. I have absolutely no idea why it strikes some of the time for our product build system. It's utterly infuriating. MSBuild14 from VS2015 was so much more manageable in this respect. This is just one of a whole pile of issues that we've had with MSBuild15, but it's the main one we have not yet solved. We just push the car back up the hill when it hits, and the next build often works. Go figure that one out!

It seemed to hit our Ranorex solution consistently however. I just don't know what the trick is to get MSBuild to use .NET Framework rather than .NET Core. Would LOVE to hear a solution to that problem.

Re: Ranorex 9.0.0 is giving error while loading Visual Studio Solution

Posted: Wed Mar 11, 2020 4:22 pm
by emil.lalkovski
Hello Stub,

Thank you very much for the detailed answers, I really appreciate it. I'll try the first solution that you provided, but since it looks a lot of pain, can you tell me please how can I downgrade to a lower version of Ranorex Studio. I saw that there are questions about that here in the forum, but when I follow the links provided for download it always downloads the latest 9.3 version... Also I cannot find the archive.

Kind regards,
Emil

Re: Ranorex 9.0.0 is giving error while loading Visual Studio Solution

Posted: Wed Mar 11, 2020 4:56 pm
by Stub
The Ranorex download archive is here.