Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Visual Studio 2015 #154

Merged
merged 10 commits into from
Aug 7, 2019
Merged
3 changes: 3 additions & 0 deletions Conan.VisualStudio.Core/Conan.VisualStudio.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
<Compile Include="ConanRunner.cs" />
<Compile Include="ConanSettings.cs" />
<Compile Include="IErrorListService.cs" />
<Compile Include="VCInterfaces\IVCConfiguration.cs" />
<Compile Include="VCInterfaces\IVCProject.cs" />
<Compile Include="VCInterfaces\IVCPropertySheet.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
35 changes: 35 additions & 0 deletions Conan.VisualStudio.Core/VCInterfaces/IVCConfiguration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Conan.VisualStudio.Core.VCInterfaces
{
public interface IVCConfiguration
{
string ProjectDirectory { get; }

string ProjectName { get; }

string Name { get; }

string ConfigurationName { get; }

string PlatformName { get; }

string RuntimeLibrary { get; }

string Toolset { get; }

string Evaluate(string value);

void AddPropertySheet(string sheet);

void CollectIntelliSenseInfo();

List<IVCPropertySheet> PropertySheets { get; }

string AdditionalDependencies { get; set; }
}
}
17 changes: 17 additions & 0 deletions Conan.VisualStudio.Core/VCInterfaces/IVCProject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Conan.VisualStudio.Core.VCInterfaces
{
public interface IVCProject
{
string ProjectDirectory { get; }

List<IVCConfiguration> Configurations { get; }

IVCConfiguration ActiveConfiguration { get; }
}
}
13 changes: 13 additions & 0 deletions Conan.VisualStudio.Core/VCInterfaces/IVCPropertySheet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Conan.VisualStudio.Core.VCInterfaces
{
public interface IVCPropertySheet
{
string PropertySheetFile { get; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2B9A58F0-6002-4477-9552-1A58386EBA96}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Conan.VisualStudio.VCProjectWrapper</RootNamespace>
<AssemblyName>Conan.VisualStudio.VCProjectWrapper14</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.VCProject, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\packages\VSSDK_VCProject.14.0.0\lib\Microsoft.VisualStudio.VCProject.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.VisualStudio.VCProjectEngine, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\packages\VSSDK_VCProjectEngine.14.0.0\lib\Microsoft.VisualStudio.VCProjectEngine.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="VCPropertySheetWrapper.cs" />
<Compile Include="VCConfigurationWrapper.cs" />
<Compile Include="VCProjectWrapper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Key.snk" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Conan.VisualStudio.Core\Conan.VisualStudio.Core.csproj">
<Project>{704bddfb-cb01-4f8b-b2a0-60bcfa97f0c2}</Project>
<Name>Conan.VisualStudio.Core</Name>
<EmbedInteropTypes>False</EmbedInteropTypes>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{896660CA-9830-425E-BC37-2928115D4FAC}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Conan.VisualStudio.VCProjectWrapper</RootNamespace>
<AssemblyName>Conan.VisualStudio.VCProjectWrapper15</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;VS15</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;VS15</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.VCProject, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.VisualStudio.VCProjectEngine, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="VCConfigurationWrapper.cs" />
<Compile Include="VCProjectWrapper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="VCPropertySheetWrapper.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Key.snk" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Conan.VisualStudio.Core\Conan.VisualStudio.Core.csproj">
<Project>{704bddfb-cb01-4f8b-b2a0-60bcfa97f0c2}</Project>
<Name>Conan.VisualStudio.Core</Name>
<EmbedInteropTypes>False</EmbedInteropTypes>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Binary file added Conan.VisualStudio.VCProjectWrapper/Key.snk
Binary file not shown.
36 changes: 36 additions & 0 deletions Conan.VisualStudio.VCProjectWrapper/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Conan.VisualStudio.VCProjectWrapper")]
[assembly: AssemblyDescription("Conan extension for Visual Studio")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("JFrog LTD")]
[assembly: AssemblyProduct("Conan.VisualStudio")]
[assembly: AssemblyCopyright("Copyright (c) 2019 JFrog LTD")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2b9a58f0-6002-4477-9552-1a58386eba96")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
114 changes: 114 additions & 0 deletions Conan.VisualStudio.VCProjectWrapper/VCConfigurationWrapper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Conan.VisualStudio.Core.VCInterfaces;
using Microsoft.VisualStudio.VCProjectEngine;

namespace Conan.VisualStudio.VCProjectWrapper
{
public class VCConfigurationWrapper : IVCConfiguration
{
private readonly VCConfiguration _configuration;
public VCConfigurationWrapper(VCConfiguration configuration)
{
_configuration = configuration;
}

private static string RuntimeLibraryToString(runtimeLibraryOption RuntimeLibrary)
{
switch (RuntimeLibrary)
{
case runtimeLibraryOption.rtMultiThreaded:
return "MT";
case runtimeLibraryOption.rtMultiThreadedDebug:
return "MTd";
case runtimeLibraryOption.rtMultiThreadedDLL:
return "MD";
case runtimeLibraryOption.rtMultiThreadedDebugDLL:
return "MDd";
default:
throw new NotSupportedException($"Runtime Library {RuntimeLibrary} is not supported by the Conan plugin");
}
}

public string ProjectDirectory => _configuration.project.ProjectDirectory;

public string ProjectName => _configuration.project.Name;

public string Name => _configuration.Name;

public string ConfigurationName => _configuration.ConfigurationName;

public string PlatformName => _configuration.Platform.Name;

public string RuntimeLibrary
{
get
{
var VCCLCompilerTool = _configuration.Tools.Item("VCCLCompilerTool");
return VCCLCompilerTool != null ? RuntimeLibraryToString(VCCLCompilerTool.RuntimeLibrary) : null;
}
}

public string Toolset
{
get
{
IVCRulePropertyStorage generalSettings = _configuration.Rules.Item("ConfigurationGeneral");
return generalSettings.GetEvaluatedPropertyValue("PlatformToolset");
}
}

public string Evaluate(string value)
{
return _configuration.Evaluate(value);
}

public void AddPropertySheet(string sheet)
{
_configuration.AddPropertySheet(sheet);
}

public void CollectIntelliSenseInfo()
{
#if VS15
_configuration.CollectIntelliSenseInfo();
#endif
}

public List<IVCPropertySheet> PropertySheets
{
get
{
List<IVCPropertySheet> propertySheets = new List<IVCPropertySheet>();
foreach (VCPropertySheet propertySheet in _configuration.PropertySheets)
propertySheets.Add(new VCPropertySheetWrapper(propertySheet));
return propertySheets;
}
}

private VCLinkerTool LinkerTool
{
get
{
IVCCollection tools = _configuration.Tools as IVCCollection;
return tools != null ? tools.Item("VCLinkerTool") as VCLinkerTool : null;
}
}

public string AdditionalDependencies
{
get
{
return LinkerTool != null ? LinkerTool.AdditionalDependencies : "";
}
set
{
if (LinkerTool != null)
LinkerTool.AdditionalDependencies = value;
}
}
}
}
Loading