Inconsistent target path between solution build and project build when platform specified
See original GitHub issueSteps to reproduce
The target path / output directory are different building the solution vs building the project when the platform is specified.
dotnet build MyProject.sln /p:Platform="Any CPU"
dotnet build MyProject.csproj /p:Platform="Any CPU"
(where MyProject.sln contains MyProject.csproj)
Expected behavior
The TargetPath for MyProject for both commands should be the same.
Actual behavior
TargetPath when building the solution: MyProject\bin\Debug\netstandard2.0\MyProject.dll
TargetPath when building the project: MyProject\bin\Any CPU\Debug\netstandard2.0\MyProject.dll
Environment data
My environment data
.NET Core SDK (reflecting any global.json):
Version: 2.2.101
Commit: 236713b0b7
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.101\
Host (useful for support):
Version: 2.2.0
Commit: 1249f08fed
.NET Core SDKs installed:
1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk]
1.0.0-preview4-004233 [C:\Program Files\dotnet\sdk]
1.0.0-rc3-004530 [C:\Program Files\dotnet\sdk]
1.0.0 [C:\Program Files\dotnet\sdk]
1.0.4 [C:\Program Files\dotnet\sdk]
1.1.0 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.502 [C:\Program Files\dotnet\sdk]
2.1.503 [C:\Program Files\dotnet\sdk]
2.1.504 [C:\Program Files\dotnet\sdk]
2.1.505 [C:\Program Files\dotnet\sdk]
2.2.101 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download```
</details>
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Solution-level `--output` option no longer valid for build- ...
When a solution is built with the --output option, the OutputPath property is set to the same value for all projects, which means...
Read more >Build specific Visual studio project under project solution ...
Here is my project structure Poject.sln ProjectA porjectB projectC Libraries libA libB msbuild "project.sln" target:"D:\Projects\Source\Demo\ ...
Read more >Inconsistent ordering of MSBuild properties added by cpp
I generally set a project's intermediate folder to C:\projects\intermediate\$(TargetName)\ and TargetName to $(ProjectName)_$(Configuration)_$( ...
Read more >Troubleshooting AWS CodeBuild
Issue: When you try to run a build project, the build fails with this error. Possible cause: Your source repository has a self-signed...
Read more >error NETSDK1194: The "--output" option isn't supported ...
The --output option is disallowed because all outputs of all built projects would be copied into the specified directory, which isn't compatible ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The solution -> individual project MSBuild call uses the solution configuration map to explicitly specify Configuration and Platform for the project. The individual project build does not, so any specified Platform would be used verbatim.
That behavior makes it sound like there’s an x64 solution configuration but it points to the AnyCPU configuration in individual projects. @tylerohlsen can you share the
.sln
file? When I created a new one I got this exact behavior:That defaulted to this solution configuration mapping:
I used the VS configuration manager to add a project platform and reference it from the x64 solution platform configuration:
At this point, everything worked:
This is very confusing. Also related to this issue:
VS2019 works fine with
<platforms>
, but dotnet only respects<platform>
even if<platforms>
has a single entry.