title: Redefinition error in propidlbase.idl when compiling ATL project in Visual Studio 2019
body: <p>I am trying to migrate a previous an older project from Visual Studio 2010 to a current version of Visual Studio (2019).
  I Microsoft's change notes on upgrading and there seem to be some changes in using ATL attributes in VS 2019 compared to how it was done before.</p>
  <p>I am able to compile the project in I am getting a bunch of redefinition errors when trying to compile this project in Visual Studio 2019.</p>
  <pre><code>4&gt;64 bit Processing .\vc140.idl
  4&gt;vc140.idl
  4&gt;64 bit Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared\wtypes.idl
  4&gt;wtypes.idl
  4&gt;64 bit Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared\wtypesbase.idl
  4&gt;wtypesbase.idl
  4&gt;64 bit Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared\basetsd.h
  4&gt;basetsd.h
  4&gt;64 bit Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared\guiddef.h
  4&gt;guiddef.h
  4&gt;64 bit Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\wincrypt.idl
  4&gt;wincrypt.idl
  4&gt;64 bit Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\prsht.idl
  4&gt;prsht.idl
  4&gt;64 bit Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\objidl.idl
  4&gt;objidl.idl
  4&gt;64 bit Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\unknwn.idl
  4&gt;unknwn.idl
  4&gt;64 bit Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\propidlbase.idl
  4&gt;propidlbase.idl
  4&gt;64 bit Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\oaidl.idl
  4&gt;oaidl.idl
  4&gt;64 bit Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\urlmon.idl
  4&gt;urlmon.idl
  4&gt;64 bit Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\oleidl.idl
  4&gt;oleidl.idl
  4&gt;64 bit Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\servprov.idl
  4&gt;servprov.idl
  4&gt;64 bit Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\msxml.idl
  4&gt;msxml.idl
  4&gt;64 bit Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\propidl.idl
  4&gt;propidl.idl
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(56): error MIDL2003: redefinition : tagVersionedStream
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(60): error MIDL2003: redefinition : PROPSETFLAG_DEFAULT
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(61): error MIDL2003: redefinition : PROPSETFLAG_NONSIMPLE
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(62): error MIDL2003: redefinition : PROPSETFLAG_ANSI
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(64): error MIDL2003: redefinition : PROPSETFLAG_UNBUFFERED
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(66): error MIDL2003: redefinition : PROPSETFLAG_CASE_SENSITIVE
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(70): error MIDL2003: redefinition : PROPSET_BEHAVIOR_CASE_SENSITIVE
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(90): error MIDL2003: redefinition : tagCAC
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(91): error MIDL2003: redefinition : tagCAUB
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(92): error MIDL2003: redefinition : tagCAI
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(93): error MIDL2003: redefinition : tagCAUI
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(94): error MIDL2003: redefinition : tagCAL
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(95): error MIDL2003: redefinition : tagCAUL
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(96): error MIDL2003: redefinition : tagCAFLT
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(97): error MIDL2003: redefinition : tagCADBL
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(98): error MIDL2003: redefinition : tagCACY
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(99): error MIDL2003: redefinition : tagCADATE
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(100): error MIDL2003: redefinition : tagCABSTR
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(101): error MIDL2003: redefinition : tagCABSTRBLOB
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(102): error MIDL2003: redefinition : tagCABOOL
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(103): error MIDL2003: redefinition : tagCASCODE
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(104): error MIDL2003: redefinition : tagCAPROPVARIANT
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(105): error MIDL2003: redefinition : tagCAH
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(106): error MIDL2003: redefinition : tagCAUH
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(107): error MIDL2003: redefinition : tagCALPSTR
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(108): error MIDL2003: redefinition : tagCALPWSTR
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(109): error MIDL2003: redefinition : tagCAFILETIME
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(110): error MIDL2003: redefinition : tagCACLIPDATA
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(111): error MIDL2003: redefinition : tagCACLSID
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(276): error MIDL2003: redefinition : tag_inner_PROPVARIANT
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(309): error MIDL2003: redefinition : PID_DICTIONARY
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(310): error MIDL2003: redefinition : PID_CODEPAGE
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(311): error MIDL2003: redefinition : PID_FIRST_USABLE
  4&gt;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\propidlbase.idl(312): error MIDL2003: redefinition : PID_FIRST_NAME_DEFAULT
  </code></pre>
  <p>This is what is in my stdafx.h file:</p>
  <pre><code>#pragma once
  #include &lt;SDKDDKVer.h&gt;
  #include &lt;atlbase.h&gt;
  #include &lt;atlcom.h&gt;
  #include &lt;atlwin.h&gt;
  #include &lt;atltypes.h&gt;
  #include &lt;atlctl.h&gt;
  #include &lt;atlhost.h&gt;
  #include &lt;comdef.h&gt;
  
  using namespace ATL;
  </code></pre>
  <p>Diving into the code it looks like this #if macro is what is triggering the second definition to be included.
  From propidlbase.idl</p>
  <pre><code>cpp_quote(&quot;#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM)&quot;)
  </code></pre>
  <p>Does this have do with the project or compiler settings, or maybe I need another #define?
  Is there anything in particular, ie hidden solution setting, that is in 2019 that need to be set in order to use ATL attributes in an application project that would cause an error like this?</p>
  <p><strong>EDIT:</strong> Per Simon's comment this is the imports of the generated idl file that I tried to compile using midl:</p>
  <pre><code>import &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\wincrypt.idl&quot;;
  import &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\prsht.idl&quot;;
  import &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\objidl.idl&quot;;
  import &quot;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\unknwn.idl&quot;;
  import &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\propidlbase.idl&quot;;
  import &quot;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\oaidl.idl&quot;;
  import &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\urlmon.idl&quot;;
  import &quot;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\oleidl.idl&quot;;
  import &quot;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\servprov.idl&quot;;
  import &quot;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\msxml.idl&quot;;
  import &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\propidl.idl&quot;;
  import &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\ocidl.idl&quot;;
  import &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\comcat.idl&quot;;
  import &quot;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\atlmfc\include\atliface.idl&quot;;
  import &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\oleacc.idl&quot;;
  import &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\shtypes.idl&quot;;
  import &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\MsHTML.idl&quot;;
  import &quot;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\dimm.idl&quot;;
  import &quot;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\dispex.idl&quot;;
  import &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared\dxgitype.idl&quot;;
  import &quot;c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\dxgicommon.idl&quot;;
  import &quot;c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\dxgiformat.idl&quot;;
  import &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\MsHtmHst.idl&quot;;
  import &quot;c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\docobj.idl&quot;;
  import &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\ExDisp.idl&quot;;
  import &quot;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\ObjSafe.idl&quot;;
  
  </code></pre>