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

Fix setting msvc compiler in profiles for Visual Studio >= 17.10 #248

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions ConanProfilesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,17 @@ private string getConanArch(string platform)
return archMap[platform];
}

private string getConanCompilerVersion(string platformToolset)
private string getConanCompilerVersion(string platformToolset, string vsVersion)
{
if (Version.TryParse(vsVersion, out Version parsedVersion))
{
// https://github.com/conan-io/conan/issues/16239
if (parsedVersion.Major == 17 && parsedVersion.Minor >= 10)
{
return "194";
}
}

var msvcVersionMap = new Dictionary<string, string>();
msvcVersionMap["v143"] = "193";
msvcVersionMap["v142"] = "192";
Expand Down Expand Up @@ -106,7 +115,8 @@ public void GenerateProfilesForProject(Project project)
string profilePath = System.IO.Path.Combine(conanProjectDirectory, profileName);

string toolset = vcConfig.Evaluate("$(PlatformToolset)").ToString();
string compilerVersion = getConanCompilerVersion(toolset);
string vsVersion = vcConfig.Evaluate("$(MSBuildVersion)").ToString();
string compilerVersion = getConanCompilerVersion(toolset, vsVersion);
string arch = getConanArch(vcConfig.Evaluate("$(PlatformName)").ToString());
IVCRulePropertyStorage generalRule = vcConfig.Rules.Item("ConfigurationGeneral") as IVCRulePropertyStorage;
string languageStandard = generalRule == null ? null : generalRule.GetEvaluatedPropertyValue("LanguageStandard");
Expand Down
2 changes: 1 addition & 1 deletion source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="VSConanPackage.4d0379e2-2698-4e66-89de-6ead71165e9f" Version="2.0.6" Language="en-US" Publisher="Conan" />
<Identity Id="VSConanPackage.4d0379e2-2698-4e66-89de-6ead71165e9f" Version="2.0.7" Language="en-US" Publisher="Conan" />
<DisplayName>Conan Extension for Visual Studio</DisplayName>
<Description xml:space="preserve">Conan Extension for Visual Studio automates the use of the Conan C/C++ package manager for retrieving dependencies within Visual Studio projects.</Description>
<MoreInfo>https://github.com/conan-io/conan-vs-extension</MoreInfo>
Expand Down
Loading