diff --git a/Conan.VisualStudio/ConanOptionsPage.cs b/Conan.VisualStudio/ConanOptionsPage.cs
index 44097c7e..15b01b70 100644
--- a/Conan.VisualStudio/ConanOptionsPage.cs
+++ b/Conan.VisualStudio/ConanOptionsPage.cs
@@ -7,6 +7,7 @@ namespace Conan.VisualStudio
public class ConanOptionsPage : DialogPage
{
private string _conanExecutablePath;
+ private string _conanInstallationPath;
private bool? _conanInstallOnlyActiveConfiguration;
private ConanGeneratorType? _conanGenerator;
private bool? _conanInstallAutomatically;
@@ -22,6 +23,15 @@ public string ConanExecutablePath
set => _conanExecutablePath = value;
}
+ [Category("Conan")]
+ [DisplayName("Conan installation directory")]
+ [Description(@"Path to the conan installation directory, may use macro like $(OutDir) or $(ProjectDir). Absolute or relative to the project directory.")]
+ public string ConanInstallationPath
+ {
+ get => _conanInstallationPath ?? (_conanInstallationPath = "$(OutDir).conan");
+ set => _conanInstallationPath = value;
+ }
+
[Category("Conan")]
[DisplayName("Install only active configuration")]
[Description(@"Install only active configuration, or all configurations")]
diff --git a/Conan.VisualStudio/Services/ConanService.cs b/Conan.VisualStudio/Services/ConanService.cs
index a5901704..9947f34d 100644
--- a/Conan.VisualStudio/Services/ConanService.cs
+++ b/Conan.VisualStudio/Services/ConanService.cs
@@ -12,7 +12,7 @@ namespace Conan.VisualStudio.Services
internal class ConanService : IConanService
{
private readonly ISettingsService _settingsService;
- private readonly Core.IErrorListService _errorListService;
+ private readonly IErrorListService _errorListService;
private readonly IVcProjectService _vcProjectService;
public ConanService(ISettingsService settingsService, Core.IErrorListService errorListService, IVcProjectService vcProjectService)
@@ -53,9 +53,14 @@ private void IntegrateIntoConfiguration(VCConfiguration configuration)
foreach (VCPropertySheet sheet in configuration.PropertySheets)
{
if (ConanPathHelper.NormalizePath(sheet.PropertySheetFile) == ConanPathHelper.NormalizePath(absPropFilePath))
+ {
+ string msg = $"[Conan.VisualStudio] Property sheet '{absPropFilePath}' already added to project {configuration.project.Name}";
+ Logger.Log(msg);
return;
+ }
}
configuration.AddPropertySheet(relativePropFilePath);
+ Logger.Log($"[Conan.VisualStudio] Property sheet '{absPropFilePath}' added to project {configuration.project.Name}");
configuration.CollectIntelliSenseInfo();
}
diff --git a/Conan.VisualStudio/Services/ISettingsService.cs b/Conan.VisualStudio/Services/ISettingsService.cs
index 76bd176c..debfa62d 100644
--- a/Conan.VisualStudio/Services/ISettingsService.cs
+++ b/Conan.VisualStudio/Services/ISettingsService.cs
@@ -8,6 +8,10 @@ public interface ISettingsService
/// Executable path. May be null if Conan not found.
string GetConanExecutablePath();
+ /// Returns Conan installation path - to be used as target for the "conan install" command.
+ /// Installation path. Might contain visual studio macro definitions (like $(OutDir)). Relative path is evaluated against project directory
+ string GetConanInstallationPath();
+
/// Returns True if install only active configuration, as defined in the project options.
/// Boolean flag describing conan installation mode
bool GetConanInstallOnlyActiveConfiguration();
diff --git a/Conan.VisualStudio/Services/VcProjectService.cs b/Conan.VisualStudio/Services/VcProjectService.cs
index 0fb443f6..e316ffa5 100644
--- a/Conan.VisualStudio/Services/VcProjectService.cs
+++ b/Conan.VisualStudio/Services/VcProjectService.cs
@@ -101,11 +101,13 @@ internal static string GetArchitecture(string platformName)
private static string GetInstallationDirectoryImpl(ISettingsService settingsService, VCConfiguration configuration)
{
string installPath = ".conan";
- if (settingsService != null && settingsService.GetConanGenerator() == ConanGeneratorType.visual_studio)
+ if (settingsService != null)
{
IVCRulePropertyStorage generalSettings = configuration.Rules.Item("ConfigurationGeneral");
- string outputDirectory = generalSettings.GetEvaluatedPropertyValue("OutDir");
- return Path.Combine(outputDirectory, installPath);
+ installPath = configuration.Evaluate(settingsService.GetConanInstallationPath());
+ if (!Path.IsPathRooted(installPath))
+ installPath = Path.Combine(configuration.project.ProjectDirectory, installPath);
+ return installPath;
}
return Path.Combine(configuration.project.ProjectDirectory, installPath);
}
diff --git a/Conan.VisualStudio/Services/VisualStudioSettingService.cs b/Conan.VisualStudio/Services/VisualStudioSettingService.cs
index 5486a119..d615bc87 100644
--- a/Conan.VisualStudio/Services/VisualStudioSettingService.cs
+++ b/Conan.VisualStudio/Services/VisualStudioSettingService.cs
@@ -26,6 +26,11 @@ public string GetConanExecutablePath()
return GetConanPage().ConanExecutablePath;
}
+ public string GetConanInstallationPath()
+ {
+ return GetConanPage().ConanInstallationPath;
+ }
+
public bool GetConanInstallOnlyActiveConfiguration()
{
return GetConanPage().ConanInstallOnlyActiveConfiguration;
diff --git a/docs/README.md b/docs/README.md
index 57abf329..70dab2fb 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -63,3 +63,16 @@ It is important to take into account:
of the Configuration and the Platform.
* For Conan profiles, the value declared will be used verbatim for the `--profile` argument
in the `conan install` command, and rules related to profile lookup applies.
+
+
+## Extension configuration
+
+There are several options available to the user to configure the extension, all of them can
+be accessed through the 'Tools' > 'Conan Package Management' > 'Options...' menu:
+
+![Conan Extension Options](images/conan-vs-extension-options.png)
+
+ * **Conan installation directory**: path where the `conanbuildinfo.props` file will be
+ generated. This path is common for all the configurations so making use of Visual Studio
+ dynamic directories like `$(Platform)` or `$(Configuration)` will be needed to avoid
+ overriding the file for different configurations.
diff --git a/docs/images/conan-vs-extension-options.png b/docs/images/conan-vs-extension-options.png
new file mode 100644
index 00000000..97511a47
Binary files /dev/null and b/docs/images/conan-vs-extension-options.png differ