{"action":"closed","issue":{"url":"https://api.github.com/repos/conan-io/conan/issues/3242","repository_url":"https://api.github.com/repos/conan-io/conan","labels_url":"https://api.github.com/repos/conan-io/conan/issues/3242/labels{/name}","comments_url":"https://api.github.com/repos/conan-io/conan/issues/3242/comments","events_url":"https://api.github.com/repos/conan-io/conan/issues/3242/events","html_url":"https://github.com/conan-io/conan/issues/3242","id":342841796,"node_id":"MDU6SXNzdWUzNDI4NDE3OTY=","number":3242,"title":"MSBuild() helper doesn't work right for some builds (DLL)","user":{"login":"solvingj","id":8557737,"node_id":"MDQ6VXNlcjg1NTc3Mzc=","avatar_url":"https://avatars0.githubusercontent.com/u/8557737?v=4","gravatar_id":"","url":"https://api.github.com/users/solvingj","html_url":"https://github.com/solvingj","followers_url":"https://api.github.com/users/solvingj/followers","following_url":"https://api.github.com/users/solvingj/following{/other_user}","gists_url":"https://api.github.com/users/solvingj/gists{/gist_id}","starred_url":"https://api.github.com/users/solvingj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solvingj/subscriptions","organizations_url":"https://api.github.com/users/solvingj/orgs","repos_url":"https://api.github.com/users/solvingj/repos","events_url":"https://api.github.com/users/solvingj/events{/privacy}","received_events_url":"https://api.github.com/users/solvingj/received_events","type":"User","site_admin":false},"labels":[{"id":314618615,"node_id":"MDU6TGFiZWwzMTQ2MTg2MTU=","url":"https://api.github.com/repos/conan-io/conan/labels/look%20into","name":"look into","color":"c44c01","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/conan-io/conan/milestones/63","html_url":"https://github.com/conan-io/conan/milestone/63","labels_url":"https://api.github.com/repos/conan-io/conan/milestones/63/labels","id":3527583,"node_id":"MDk6TWlsZXN0b25lMzUyNzU4Mw==","number":63,"title":"1.8","description":null,"creator":{"login":"lasote","id":3807515,"node_id":"MDQ6VXNlcjM4MDc1MTU=","avatar_url":"https://avatars1.githubusercontent.com/u/3807515?v=4","gravatar_id":"","url":"https://api.github.com/users/lasote","html_url":"https://github.com/lasote","followers_url":"https://api.github.com/users/lasote/followers","following_url":"https://api.github.com/users/lasote/following{/other_user}","gists_url":"https://api.github.com/users/lasote/gists{/gist_id}","starred_url":"https://api.github.com/users/lasote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lasote/subscriptions","organizations_url":"https://api.github.com/users/lasote/orgs","repos_url":"https://api.github.com/users/lasote/repos","events_url":"https://api.github.com/users/lasote/events{/privacy}","received_events_url":"https://api.github.com/users/lasote/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":1,"state":"open","created_at":"2018-07-27T09:35:28Z","updated_at":"2018-08-26T23:06:41Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2018-07-19T18:33:15Z","updated_at":"2018-08-26T23:06:41Z","closed_at":"2018-08-26T23:06:40Z","author_association":"CONTRIBUTOR","body":"Conan 1.5.2 and Conan 1.6.0\r\n\r\nThe following build helper method call fails on some of our builds due to 1500 missing symbols (Of note, only shared/DLL builds):\r\n\r\n```\r\n        msbuild.build(\r\n            self._build_filename, \r\n            upgrade_project=False,\r\n            targets=self._build_targets,\r\n            build_type=carsim_build_type,\r\n            platforms={\"x86\":\"Win32\"},\r\n            use_env=False,\r\n        )\r\n```\r\nMeanwhile, this works for DLL builds (even though it produces a nearly identical CLI call):\r\n\r\n```\r\n        vcvars_cmd = tools.vcvars_command(self.settings)\r\n\r\n        build_cmd = msbuild.get_command(\r\n            self._build_filename, \r\n            upgrade_project=False,\r\n            targets=self._build_targets,\r\n            build_type=carsim_build_type,\r\n            platforms={\"x86\":\"Win32\"},\r\n            use_env=False,\r\n        )\r\n\r\n        self.run(vcvars_cmd + \" && \" + build_cmd)\r\n```\r\nHere's the CLI call printed from the failing build: \r\n`set \"VSCMD_START_DIR=%CD%\" && call \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\VC/Auxiliary/Build/vcvarsall.bat\" amd64 && msbuild vssharedbuffer.sln /p:Configuration=\"Release DLL\" /p:Platform=\"x64\" /m:8 /p:ForceImportBeforeCppTargets=\"C:\\Users\\jwiltse\\AppData\\Local\\Temp\\tmpzuwro29htmp_conan\\t\"\r\n`\r\n\r\nCLI call printed from the working build:\r\n`set \"VSCMD_START_DIR=%CD%\" && call \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\VC/Auxiliary/Build/vcvarsall.bat\" amd64 && msbuild vssharedbuffer.sln /p:Configuration=\"Release DLL\" /p:Platform=\"x64\" /m:8`\r\n\r\n\r\nThe two possible differences that could explain the behavior are: \r\n1. `/p:ForceImportBeforeCppTargets`\r\n2. Conan could be applying environment variables from dependencies implicitly when using MSBuild() helper.  Since it's causing a linker failure for a DLL, it could be related to `PATH` or `LIBPATH`.\r\n\r\nI don't think it's possible for me to debug whatever is passed via `/p:ForceImportBeforeCppTargets` because the path passed is always empty.\r\n\r\nIf the environment variables are the problem, I can't imagine exactly why the environment variables would cause these errors, but I can see it being a possibility.  It wouldn't surprise me if the assumption was that the environment variables would never hurt anything, or if they were applied incidentally and nobody even realized it was happening.  It's possible that in 99% of cases, it doesn't hurt anything, but there's something rare and particular in our projects which results in this issue. \r\n\r\nFortunately, I can workaround the issue by creating the commands manually.\r\n\r\n- [x] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).\r\n- [x] I've specified the Conan version, operating system version and any tool that can be relevant.\r\n- [x] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.\r\n\r\n"}}
{"actor":{"display_login":"solvingj"}}