c# – Post build event return 9009 even though path is correct


Using VS2022. I have a post build event for a project to build another project:

msbuild $(SolutionDir)public.site\public.site.Server\public.site.Server.csproj /p:Configuration=$(Configuration) /p:Platform=$(Platform)

When I build the project with the post build event, I get the following error:

The command "msbuild C:\code\public.site\public.site.Server\public.site.Server.csproj /p:Configuration=Debug /p:Platform=AnyCPU" exited with code 9009.

But, if I open a developer command prompt and paste “msbuild C:\code\public.site\public.site.Server\public.site.Server.csproj /p:Configuration=Debug /p:Platform=AnyCPU”, it builds just fine.

Can anyone tell me why I’m receiving the 9009 error even though paths are correct and if I run the command manually, it works?

Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *