Please release a 2017-preview compatible version
janwilmans opened this issue · 31 comments
tried to install 1.3.3 -> does not support vs2017 yet.
I do see commits to fix this, but was unable to build the sources in vs2017 :)
After fixing the references and re-targetting to .net platform 4.6.2, I ended up with
C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\MSBuild\Microsoft\VisualStudio\v15.0\VSSDK\Microsoft.VsSDK.targets(99,5): error VSSDK1078: The VSIX manifest must contain element 'Prerequisites'. For more information, https://go.microsoft.com/fwlink/?linkid=839777
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I realized its a vs2015 project, so someone, pretty please build a new release for us 2017 people :)
Odd, I thought I fixed this. Perhaps, I forgot to commit something, will check when I get to the office where I have the latest version. It does build in 2017 and install into 2017 for me.
Problem is, the extension is currently unusable in 2017 because of #156
Ok, thanks for the swift response. In the coming three weeks I'm very busy, but if the projects builds/installs in vs2017 and the problem persists when I'm back I'm willing to look into it myself, I'll check back in a while
Gotcha. Maybe I'll finally get around to fixing it myself. I more or less know how to do it, but it's tedious.
Weird, but I am building the revision from master with and for VS 2017 no problem. I don't know why it doesn't work for you.
Maybe I did something wrong, or it might be a vs2017 preview specific problem (i'm using the preview edition). I will re-test.
I'm using the latest final update.
Opening the solution, I first get a project-conversion:
And building the project, I get this:
1>------ Build started: Project: CPPCheckPlugin, Configuration: Debug Any CPU ------
1>C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3275: The primary reference "Microsoft.VisualStudio.Shell.Immutable.10.0" could not be resolved because it has an indirect dependency on the assembly "Microsoft.VisualStudio.Utilities, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which was built against the ".NETFramework,Version=v4.6" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5".
1>C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3275: The primary reference "Microsoft.VisualStudio.Shell.Immutable.11.0" could not be resolved because it has an indirect dependency on the assembly "Microsoft.VisualStudio.Utilities, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which was built against the ".NETFramework,Version=v4.6" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5".
1>C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.Shell.11.0". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.VCProjectEngine, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2604,5): warning MSB3283: Cannot find wrapper assembly for type library "Microsoft.VisualStudio.CommandBars". Verify that (1) the COM component is registered correctly and (2) your target platform is the same as the bitness of the COM component. For example, if the COM component is 32-bit, your target platform must not be 64-bit.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Which (i believe) means that although it can be build in vs2017, it relies on vs2015 being installed.
I think this is because the project targets VS 2015 SDK, so you need to have that SDK installed.
I believe this is required to maintain compatibility with VS 2015. If not, someone please correct me.
Here is what solved it for me (Windows 7, Visual Studio 2017) : in source.extension.vsixmanifest, add a Prerequisite to "Visual Studio core editor". The version range for me that was automatically filled was [15.0.26606.0,16.0)
(I also had to change a bunch of references to assemblies etc etc... But when I got the the point of the error message " The VSIX manifest must contain element 'Prerequisites'", that's what solved it for me. After that it was built and installed on VS 2017 no problem)
@Altrue : can you please change the minimum version of that prerequisite from 15 to 14 or 13 (the lowest that won't cause build issues), and make a pull request?
I actually don't think that it worked :(
It did build and install properly, but once I try to scan anything in VS it never reports any error or does anything. And my projects apparently aren't "C++ projects" somehow.
I'm using the GUI version separately for my projects for now. That works well at least :)
Closing as the original issue had been sorted, and the other one is already open.
@Altrue @janwilmans
I have released the new version of the plugin that should work with VS 2017 (it works for me). Please try it out.
@VioletGiraffe I've installed successfully with the latest VS2017 (Release, not Preview).
It works with small solution with single project (.vcxproj
manually created using the VS2017), with single .cpp file.
If I try to use it with large solution with number of projects (all .vcxproj
manually created using the VS2017), then I'm getting an error:
The same error happens for not-so-big solution with projects generated with CMake 3.9.
Right-click in Solution Explorer on individual files or projects as well makes no difference and the same error occurs. VS restarts do not help.
@mloskot
That does not occur with two of my largest solutions, one containing 5 projects and the other - 28. I will try it out on another PC, but if I won't get this error, someone else will have to debug it.
@VioletGiraffe
I have tested it on another Windows 10 machine and also with latest VS2017 (15.3.4).
-
If I load single
.vcxproj
into VS, the add-in works and analyses the project.
and it seems to work there. -
If I add another
.vcxproj
to the same solution as loaded above, it still works. -
If I load large (+200
.vcxproj
) solution, it no longer works. It throws the error about "Object reference..." as above or this one, randomly:
I confirmed all projects have the same Configuration/Platform selected. -
Then, I start removing projects one by one and at some point, after re-loading smaller solution, the add-in starts working again.
I know this is probably of little help, but perhaps it will ring a bell.
I'm not able to debug the thing now.
I also tried the latest w/ VS2012, see #171
Thanks for the info. I'll try to find a test solution that would trigger this behavior. Do you know of a suitable open-source project?
Do you know of a suitable open-source project?
My favourite among giants is .sln
with ~450 .vcxproj
one can generate with CMake to build LLVM/clang.
That sounds like fun...
At least I have an SSD and a decent 8-core CPU, I should be able to open it if I let it do its thing for the whole evening, right? :)
LLVM without clang and cmake-configured without some optional modules should make it less :)
Would it be possible to reproduce the problem by creating an empty solution and then adding newly created "Win32 console application" projects into it?
@Dmitry-Me: good idea!
So it's the same problem that I came across yesterday when debugging #156: reflection doesn't work, quite literally. And I don't understand why. In that case it was the function isCppProject
, this time it's isCppFile
.
Any chance this bug reported for VS2017 is related VCProject.Configurations property broken for multiple C++ projects. That kind of seems to link to the "no valid configuration selected" error from the screenshot earlier.
It is about property of Microsoft.VisualStudio.VCProjectEngine.VCProject
interface.
Disclaimer: I have never written a single VS extension. I know nothing. ~John Snow ;)
@mloskot
I have not gotten the configuration error message yet so I can't say. Have been debugging "Object reference not set to an instance". Good find, though.
I was able to install 1.3.4 on visual studio preview, but on this project:
https://github.com/CobaltFusion/DebugViewPP
So I hope thats a reproduction scenario for you?
I was able to build the head in vs2017, and attached the debugger:
Maybe this is helpfull:
https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.vcprojectengine.vcprojectengine.aspx
at the bottom of the page:
remark
You cannot instantiate a stand-alone VCProjectEngine object because additional binaries must be
deployed in the folder that contains the application. Instead, obtain a VCProjectEngine object from a
project that has been opened in Visual Studio.
@janwilmans
The problem is with reflection. A valid VCFile
instance is obtained in CPPCheckPluginPackage.cs:538. I can get file.Type
there no problem. But after I pass this file
to isCppFile
as dynamic
, I cannot obtain its Type
through reflection. And I don't understand why.
@janwilmans: right, and I don't quite understand what this code even does (luckily, I'm not its author, he-he). The way I see it, isCppFile
should be doing the following:
var fileObjectType = file.GetType();
var fileType = fileObjectType.GetProperty("FileType").GetValue(file);
But it doesn't work either.