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

Can I configure my own artifactory repository instead of always defaulting to conan center? #224

Open sandybhat16 opened 3 months ago

sandybhat16 commented 3 months ago

I have started using this extension but what I have observed is that it always points to the ConanCenter to fetch the packages. Is there a way I can configure my own artifactory repository or have more than one just like how Nuget supports?

czoido commented 3 months ago

Hi @sandybhat16,

Thanks a lot for testing the VS extension.

Right now, the list of Conan packages comes from a hardcoded json that's updated daily to reflect the updates in Conan Center (if you click the 🔄 button it will be updated) but there's no option to show the contents of a custom repo. You can edit the conandata.yml that the extension generates (dont forget to remove the comments, otherwise the extension overwrites the contents) and there you can specify your own packages, that will be fetched by order of preference that you have configured in the same way that any regular conan install works. Is this helping?

sandybhat16 commented 3 months ago

@czoido Thank you for your response. Is there a way that we can have a custom JSON locally that I can configure to use with the VS Extension? If not then, the step you mentioned to edit the conandata.yml. Is there a way to define source as well? So that all the packages under requirements uses the same source. In this way I can achieve all the packages to be fetched from my custom repository.

czoido commented 3 months ago

@czoido Thank you for your response. Is there a way that we can have a custom JSON locally that I can configure to use with the VS Extension? If not then, the step you mentioned to edit the conandata.yml. Is there a way to define source as well? So that all the packages under requirements uses the same source. In this way I can achieve all the packages to be fetched from my custom repository.

I would not recommend you to edit the json where the packages are stored, it can lead to extension crashes as the format is not stable and will probably change in the future. I think the easiest way of making sure that you fetch the requirements from your custom repository putting your remote first in the list of remotes (you can do that with conan remote update if you already have the remote configured) or even removing or disabling all remotes but the one you want. Another option is modifying the arguments for the pre-build event (image attached) that the extension injects to the project addind the -r <yourremote> argument but I think the other option would be better.

image

Hope this helps.