OpenCppCoverage / OpenCppCoveragePlugin

Official Visual Studio Plugin for OpenCppCoverage
GNU General Public License v3.0
67 stars 28 forks source link

'CoverageData.cs' could not be found. #19

Closed hsandt closed 6 years ago

hsandt commented 6 years ago

I opened CppCoveragePlugin.sln in VS 2017 Professional on Windows 10. When building VSPackage, I got:

CSC : error CS2001: Source file 'C:\Users\NAME\Developer\Visual Studio\OpenCppCoveragePlugin-master-2018-01-30\VSPackage\CoverageData\CoverageData.cs' could not be found.

OpenCppCoverage commented 6 years ago

Hello,

CoverageData.cs is generated from the protobuff file CoverageData.proto. This is done during the prebuild event of VSPackage project. Can you check the nuget package Google.ProtocolBuffers.2.4.1.555 is correctly installed? If yes, can you try to run the prebuild command from a command line to see where the problem is?

I hope it will help,

OpenCppCoverage

OpenCppCoverage commented 6 years ago

Hello,

Feel free to reopen the issue if you still have the problem.

OpenCppCoverage

hsandt commented 6 years ago

So I checked the list of installed plugins and can see Google.ProtocolBuffers image

I also checked that the pre-build step was using it. Then I inspected the build steps and it seems that a path containing a whitespace is not supported:

1>------ Build started: Project: VSPackage, Configuration: Debug Any CPU ------ 1> Invalid options: 1> Specified output directory ($HOME\Developer\Visual doesn't exist. 1> Input file Studio\OpenCppCoveragePlugin-master-2018-01-30\OpenCppCoveragePlugin-master\VSPackage\CoverageData doesn't exist. 1> Input file Studio\OpenCppCoveragePlugin-master-2018-01-30\OpenCppCoveragePlugin-master\VSPackage\CoverageData doesn't exist. 1> Input file CoverageData.proto doesn't exist. 1>

The full path is $HOME\Developer\Visual Studio\OpenCppCoveragePlugin-master-2018-01-30\OpenCppCoveragePlugin-master\VSPackage

I will try again with a no-space path.

hsandt commented 6 years ago

It works with "VisualStudio" instead of "Visual Studio" in the path (of course, this needs to be fixed anyway). Now I have a different error about assembly reference:

1>$HOME\lnguyenhuu\Developer\VisualStudio\OpenCppCoveragePlugin-master\VSPackage\CoverageRunner.cs(125,40,125,59): error CS0012: The type 'JoinableTaskFactory' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.VisualStudio.Threading, Version=15.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

hsandt commented 6 years ago

Next step: I went to Solution Explorer, unfolded VSPackage > References > Microsoft.VisualStudio.Threading. It had a small warning icon on it. Then right-click > Properties showed it was the only DLL with no version set (btw, looking for the error message above will get your answers referring to wrong version numbers). I simply set the "Specific Version" to True, which updated the Version to 15.6.0.0 (instead of 15.0.0.0 for other DLLs). From then on you can switch back Specific Version to False, the Version will stay.

Then if you build again:

1>------ Build started: Project: VSPackage, Configuration: Debug Any CPU ------ 1> VSPackage -> $HOME\Developer\VisualStudio\OpenCppCoveragePlugin-master\VSPackage\bin\Debug\VSPackage.dll 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\VSSDK\Microsoft.VsSDK.targets(622,5): error VSSDK1025: Could not add the file "OpenCppCoverage-x64\boost_chrono-vc140-mt-1_59.dll" to the zip package "bin\Debug\VSPackage.vsix". Could not find file '$HOME\Developer\VisualStudio\OpenCppCoveragePlugin-master\VSPackage\OpenCppCoverage-x64\boost_chrono-vc140-mt-1_59.dll'.

The last error is the same as mentioned in https://github.com/OpenCppCoverage/OpenCppCoverage/issues/1

and it may be an important error since when I double-click on the produced .vsix (in the Debug or Release folder), I get

Install failed - Install of "" (sic) failed ... the file is not a valid VSIX package (translation)

In Release, I also get warnings but that's another issue.

As for the tests (Debug only):

2>------ Build started: Project: VSPackage_IntegrationTests, Configuration: Debug Any CPU ------ 3>------ Build started: Project: VSPackage_UnitTests, Configuration: Debug Any CPU ------ ... 3> Consider app.config remapping of assembly "Microsoft.VisualStudio.Threading, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "15.3.0.0" [] to Version "15.6.0.0" [C:\Users\lnguyenhuu\Developer\VisualStudio\OpenCppCoveragePlugin-master\VSPackage\bin\Debug\Microsoft.VisualStudio.Threading.dll] to solve conflict and get rid of warning. (more similar warnings)

but I can't change the greyed out Version in Microsoft.VisualStudio.Threading and I get that's related to my install of .NET, so I just ignored the warnings.

hsandt commented 6 years ago

Step 3: the boost_ dll s are in the correct folder but have a different version. So I renamed: boost_chrono-vc141-mt-x64-1_66.dll -> boost_chrono-vc140-mt-1_59.dll trying not to fear incompatibility issues. I renamed the other boost dll s the same.

Of course, the real fix should be to update the project to support the right DLL versions.

After doing this a last DLL, regex, was still missing:

1>------ Build started: Project: VSPackage, Configuration: Debug Any CPU ------ 1> VSPackage -> C:\Users\lnguyenhuu\Developer\VisualStudio\OpenCppCoveragePlugin-master\VSPackage\bin\Debug\VSPackage.dll 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\VSSDK\Microsoft.VsSDK.targets(622,5): error VSSDK1025: Could not add the file "OpenCppCoverage-x64\boost_regex-vc140-mt-1_59.dll" to the zip package "bin\Debug\VSPackage.vsix". Could not find file 'C:\Users\lnguyenhuu\Developer\VisualStudio\OpenCppCoveragePlugin-master\VSPackage\OpenCppCoverage-x64\boost_regex-vc140-mt-1_59.dll'.

I'll try to install boost now...

hsandt commented 6 years ago

Step 4: install boost by yourself to get the DLLs

bootstrap
b2 runtime-link=shared

(you can add options to focus on regex and gain compile time I think)

Copy the regex DLL matching your architecture to the OpenCppCoverage-x64 folder and rename it "boost_regex-vc140-mt-1_59.dll" (hacky again). The previous error will be fixed.

Now I only have this error:

1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\VSSDK\Microsoft.VsSDK.targets(622,5): error VSSDK1025: Could not add the file "OpenCppCoverage-x64\dbgcore.dll" to the zip package "bin\Release\VSPackage.vsix". Could not find file '$HOME\Developer\VisualStudio\OpenCppCoveragePlugin-master\VSPackage\OpenCppCoverage-x64\dbgcore.dll'.

OpenCppCoverage commented 6 years ago

Hello,

Thank you for reporting this issue.

You have issues with dynamic libraries like boost_chrono-vc140-mt-1_59.dll or dbgcore.dll because OpenCppCoverage Plugin was using OpenCppCoverage 0.9.6.1 libraries (Compiled with Visual Studio 2015).

Yesterday, I updated the code source of OpenCppCoverage Plugin and now you can compile it with OpenCppCoverage 0.9.7.0 libraries (Compiled with Visual Studio 2017). Note: You need Visual Studio 2017 15.8.X to avoid Microsoft.VisualStudio.Threading version issue.

I have just pushed a fix to support spaces in the project path and now it should work out of the box.

I hope it will help,

OpenCppCoverage

OpenCppCoverage commented 6 years ago

Hello,

Feel free to reopen the issue or create a new one if the problem still exist.

OpenCppCoverage