conan-io / conan-vs-extension

Conan Extension for Visual Studio
https://marketplace.visualstudio.com/items?itemName=conan-io.conan-vs-extension
MIT License
59 stars 34 forks source link

Add support for Visual Studio 2015 #154

Closed SSE4 closed 4 years ago

SSE4 commented 4 years ago

closes #98 closes #66 closes #75

extension doesn't work in Visual Studio 2015 - it's because interface Microsoft.VisualStudio.VCProject has changed between versions 14.0 and 15.0 and it's no longer compatible. unfortunately, it's impossible to reference both versions of the same interface within single assembly. it's also impossible to solve it somehow in runtime, as at compile time expression like project as VCProject compiles differently depends on VCProject interface version (or more precisely, its guid). the solution is pretty straightforward:

  1. wrap all code needed from Microsoft.VisualStudio.VCProject and Microsoft.VisualStudio.VCProjectEngine into small wrapper classes. for now, just 3 classes are needed: VCConfiguration, VCProject and VCPropertySheet. (other classes might be easily added on demand using the same approach)
  2. define corresponding interfaces within Core project, so classes are never referenced directly, and we can use late binding for them, so they are loosely coupled.
  3. create two wrapper assemblies for two Visual Studio versions: VCProjectWrapper14 and VCProjectWrapper15. both assemblies use the same sources (3 wrapper classes mentioned above), but reference to different versions of Microsoft.VisualStudio.VCProject
  4. in main assembly, load required wrapper assembly based on the Visual Studio version in use. from the loaded assembly, create an instance of VCProjectWrapper (from the EnvDTE.Project.object) and use it going forward.
  5. ensure we're not referencing Microsoft.VisualStudio.VCProject (and VCProjectEngine) from the main assembly.
  6. downgrade all Visual-Studio related assembly references to the 14.0, so they could be loaded by Visual Studio 2015
  7. use Microsoft.VisualStudio.VCProject (and VCProjectEngine) version 14.0 from NuGet, as we're building on VS2019 image which doesn't have older assemblies installed.
SSE4 commented 4 years ago

seems like build fails because assemblies like Microsoft.VisualStudio.VCProject, Version=14.0.0.0 aren't found on appveyor... maybe need to try to build on VS2017 appveyor image

jgsogo commented 4 years ago

Look at this wonderful image, Version: 14.0.25431 😍😍😍

image

Please, rebase on top of dev and now the Appveyor wars will start again ^^