Skip to content

warning MSB8027: Two or more files with the name of WindowsAppRuntimeAutoInitializer.cpp will produce outputs to the same location.Β #5395

Closed

Description

I got this warning in my project. Later it is followed by this warning:
WindowsAppRuntimeAutoInitializer.obj : warning LNK4042: object specified more than once; extras ignored

The solution consist of (among others) two c++ projects: exe and dll - both are using the same version WindowsAppSDK (1.7.250401001) nuget.

I think it is caused by WindowsAppSDK nuget that has WindowsAppSDK-Nuget-Native.AutoInitializer.targets
in buildTransitive directory. Also I think older versions of WindowsAppSDK haven't produced such warnings.

Is there a way to prevent the warnings?

Activity

  1. added
    area-DeveloperToolsIssues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration
    on May 5, 2025
  2. PetrMinar commented on May 22, 2025

    @PetrMinar
    Author

    Still no update? I try to use new version of WindowsAppSDK (1.7.250513003) and the result is still the same. Additionaly new warning appeared:
    xxx\Microsoft.Common.CurrentVersion.targets(2434,5): warning MSB3106: Assembly strong name "xxx\Microsoft.Windows.AI.Foundation.winmd" is either a path which could not be found or it is a full assembly name which is badly formed. If it is a full assembly name it may contain characters that need to be escaped with backslash(\). Those characters are Equals(=), Comma(,), Quote("), Apostrophe('), Backslash(\).

    There is no warning while using WindowsAppSDK 1.6.240923002.

    I even prepared sample solution where you can reproduce the error.

  3. linked a pull request that will close this issue[Issue 5395] Fix msbuild warnings #5685on Aug 12, 2025
  4. ssparach commented on Sep 2, 2025

    @ssparach
    Contributor

    Reopening issue. See #5760 for more information.

  5. mschofie commented on Oct 7, 2025

    @mschofie

    Just qualifying the metadata access appears to fix things for me. i.e. converting:

          <ClCompile Include="$(MSBuildThisFileDirectory)..\..\include\WindowsAppRuntimeAutoInitializer.cpp">
            <PrecompiledHeader>NotUsing</PrecompiledHeader>
            <PreprocessorDefinitions Condition="'$(WindowsAppSdkBootstrapInitialize)'=='true'">MICROSOFT_WINDOWSAPPSDK_AUTOINITIALIZE_BOOTSTRAP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
            <PreprocessorDefinitions Condition="'$(WindowsAppSdkDeploymentManagerInitialize)'=='true'">MICROSOFT_WINDOWSAPPSDK_AUTOINITIALIZE_DEPLOYMENTMANAGER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
            <PreprocessorDefinitions Condition="'$(WindowsAppSdkUndockedRegFreeWinRTInitialize)'=='true'">MICROSOFT_WINDOWSAPPSDK_AUTOINITIALIZE_UNDOCKEDREGFREEWINRT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
            <PreprocessorDefinitions Condition="'$(WindowsAppSdkCompatibilityInitialize)'=='true'">MICROSOFT_WINDOWSAPPSDK_AUTOINITIALIZE_COMPATIBILITY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
          </ClCompile>

    To:

          <ClCompile Include="$(MSBuildThisFileDirectory)..\..\include\WindowsAppRuntimeAutoInitializer.cpp">
            <PrecompiledHeader>NotUsing</PrecompiledHeader>
            <PreprocessorDefinitions Condition="'$(WindowsAppSdkBootstrapInitialize)'=='true'">MICROSOFT_WINDOWSAPPSDK_AUTOINITIALIZE_BOOTSTRAP;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
            <PreprocessorDefinitions Condition="'$(WindowsAppSdkDeploymentManagerInitialize)'=='true'">MICROSOFT_WINDOWSAPPSDK_AUTOINITIALIZE_DEPLOYMENTMANAGER;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
            <PreprocessorDefinitions Condition="'$(WindowsAppSdkUndockedRegFreeWinRTInitialize)'=='true'">MICROSOFT_WINDOWSAPPSDK_AUTOINITIALIZE_UNDOCKEDREGFREEWINRT;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
            <PreprocessorDefinitions Condition="'$(WindowsAppSdkCompatibilityInitialize)'=='true'">MICROSOFT_WINDOWSAPPSDK_AUTOINITIALIZE_COMPATIBILITY;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
          </ClCompile>
  6. mschofie commented on Oct 7, 2025

    @mschofie

    Sorry, that only removed some of the problems... Still looking...

  7. mschofie commented on Oct 7, 2025

    @mschofie

    It looks like the premise is wrong - the Target is attempting to add a ClCompile Item, and is using %(PreprocessorDefinitions)/%(ClCompile.PreprocessorDefinitions) to do so. But that's ItemDefinitionGroup-syntax for accessing the previously defined metadata values, and isn't valid in an ItemGroup. Infact, within a Task, the %(PreprocessorDefinitions)-syntax will cause Task batching, which will call the Task (i.e. CreateItem) once per 'set' of PreprocessorDefinitions, which is presumably why we're getting multiple ClCompile items.

  8. PetrMinar commented on Apr 30, 2026

    @PetrMinar
    Author

    Any update on this? The "duplicate 'WindowsAppRuntimeAutoInitializer.cpp' compilation" is still present in almost every build even under just released WinAppSDK 2.0.1 Stable... Looking at closed link I have hoped it is fixed.

  9. agniuks commented on May 12, 2026

    @agniuks
    Contributor

    Fixed in 1.8.8, and a fix is coming to 2.0-stable next week.

  10. lauren-ciha commented on Oct 21, 2026

    @lauren-ciha
    Member

    The fix for this issue was shipped in 1.8.8 and 2.0, so I am closing this as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-DeveloperToolsIssues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions