conan-vs-extension icon indicating copy to clipboard operation
conan-vs-extension copied to clipboard

conanbuildinfo.props is added multiple times to same configuration

Open memsharded opened this issue 5 years ago • 3 comments

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

memsharded avatar Jul 04 '19 18:07 memsharded

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

SSE4 avatar Jul 05 '19 13:07 SSE4

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?

jgsogo avatar Jul 16 '19 09:07 jgsogo

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?

Woazim avatar Jan 29 '21 11:01 Woazim