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

conanbuildinfo.props is added multiple times to same configuration #128

Closed memsharded closed 8 months ago

memsharded commented 5 years ago

Not sure how I got to this, but the final result is:

<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    <Import Project="..\x64\Release\.conan\conanbuildinfo.props" />
    <Import Project="..\x64\Release\.conan\conanbuildinfo.props" />
    <Import Project="..\x64\Release\.conan\conanbuildinfo.props" />
  </ImportGroup>

Probably it needs to check for existence to not repeat it

SSE4 commented 5 years ago

very strange, we already have fixed such issue in the past: https://github.com/conan-io/conan-vs-extension/issues/77

jgsogo commented 5 years ago

This was an issue before, but now (v1.1.x) we are checking for a property file with the same path before adding it to the project. Can you re-check the version you are using?

One more thing to try, just in case: what happens if I run Conan several times without waiting for a previous run to finish?

Woazim commented 3 years ago

I experience the same problem (for your information, I'm using v1.2.2.346 from Visual Studio marketplace). If you run conan several times on the same project / solution, there is no problem, since it is checked that it not exists before adding it to project. Checked in this function: ConanService.IntegrateIntoConfiguration But, the check relies on Visual Studio property "VCConfiguration.PropertySheets" there

The problem appears when you delete conanbuildinfo.props (this could frequently append, since it's located in $(OutDir)). To reproduce the issue, do this:

  1. Create a Solution/Project that use conan.
  2. Run conan on this project --> conanbuildinfo.props is created and corectly added.
  3. Close Visual Studio to be sure.
  4. Delete $(OutDir) from your hard drive
  5. Open your Visual Studio solution (in my case, Visual has a lot of complains in its output window "error : Designtime build failed for project 'project' configuration 'Debug|x64'. IntelliSense might be unavailable. Set environment variable TRACEDESIGNTIME = true and restart Visual Studio to investigate."
  6. You can observe in Property Manager that Visual Studio doesn't see any reference to conanbuildinfo: image
  7. Run conan --> a new property sheet is wrongly added to the project: [Conan.VisualStudio] Property sheet '.......\x64\Debug.conan\conanbuildinfo.props' added to project FirstRectangle And it's now visible twice in Property Manager: image

I hope that it will help to find how to resolve this issue. Is it Microsoft responsibility, since Visual doesn't report this property sheet when it's not accessible?