Repository navigation
Description
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
CanIGetaPR commentedon Mar 24, 2023
Changing msbuild's target to the csproj didn't help either. Eg
msbuild MySolution\MyProject.csproj [..]JaynieBai commentedon Apr 11, 2023
@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.
sap4hana commentedon Sep 26, 2024
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