Skip to content

[Broken Build]: apphost.exe is missing from the runtime obj folder #8596

Closed

Description

@CanIGetaPR

Issue Description

MSBuild version 17.3.2+561848881 for .NET
dotnet\sdk\6.0.407\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(277,5): error MSB3030:
Could not copy the file obj\x64\Release\net6.0\win-x64\apphost.exe because it was not found.

The build fails because apphost.exe isn't present in the win-x64 folder. There's a singlefilehost.exe file in there, but the apphost.exe file is only present in the parent directory obj\x64\Release\net6.0\.

I can work-around this issue by manually copying the apphost.exe from obj\x64\Release\net6.0\ into ``obj\x64\Release\net6.0\win-x64` and re-running the build. Though perhaps it would be better suited to create a symbolic link.

Project configuration:

  <PropertyGroup>
   <ApplicationIcon />
   <OutputType>exe</OutputType>
   <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
   <StartupObject />
   <Prefer32Bit>false</Prefer32Bit>
   <PlatformTarget>x64</PlatformTarget>
   <TargetFramework>net6.0</TargetFramework>
   <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
   <Configurations>Debug;Release</Configurations>
   <Platforms>x64</Platforms>
   <RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
 </PropertyGroup>

Build command:

msbuild MySolution.sln /t:Clean;Restore;Publish /p:PublishSingleFile=True /p:SelfContained=True /p:Configuration=release /p:Platform=x64 /p:RuntimeIdentifier=win-x64

Steps to Reproduce

Delete the bin and obj directories and try publishing using msbuild.

Note: dotnet publish is not an option because this solution has .NET 6 and .NET Framework 4.8 projects.

Expected Behavior

Build completes.

Actual Behavior

Build fails because it didn't place the apphost.exe file where it needs it.

Ask us questions

This build was previously working fine with a combination of msbuild and dotnet publish commands in .NET 5.0 and earlier.

I started getting staticwebassets.build.json is missing, and a runtime json which I fixed using <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> .

Activity

  1. added
    needs-triage
    on Mar 24, 2023
  2. CanIGetaPR commented on Mar 24, 2023

    @CanIGetaPR
    Author

    Changing msbuild's target to the csproj didn't help either. Eg msbuild MySolution\MyProject.csproj [..]

  3. JaynieBai commented on Apr 11, 2023

    @JaynieBai
    Member

    @CanIGetaPR Could you msbuild build with /bl that will generate a file that is a detailed description of the build process? And share the file please.

  4. added
    needs-more-info
    on Apr 12, 2023
  5. ghost removed
    needs-triage
    on Apr 12, 2023
  6. ghost added
    stale
    on May 13, 2023
  7. ghost closed this as completedon May 27, 2023
  8. ghost added
    closed-by-bot
    on May 27, 2023
  9. sap4hana commented on Sep 26, 2024

    @sap4hana

    I have installed template WinFormsProjectTemplate.vsix from https://sciber.gallerycdn.vsassets.io/extensions/sciber/cppwinformsproject/1.1/1639892577379/WinFormsProjectTemplate.vsix

    Then created new CLR-CPP project. (TargetFramework is 8.0)

    I got the same error:
    1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5321,5): error MSB3030: cannot copy "C:\Users\Lu\source\repos\ProjectWix\Project2\x64\Debug\apphost.exe" - file not found

    The msbuild /bl output is attached

    msbuild.output.txt

    Greetings

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

Metadata

Metadata

Assignees

Labels

closed-by-botneeds-more-infostale

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions