Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent dotnet build behaviour between configurations #45200

Open
woodylaurence opened this issue Nov 27, 2024 · 0 comments
Open

Inconsistent dotnet build behaviour between configurations #45200

woodylaurence opened this issue Nov 27, 2024 · 0 comments
Labels
Area-NetSDK untriaged Request triage from a team member

Comments

@woodylaurence
Copy link

Describe the bug

Building application with project reference on another project seems to behave differently depending on which configuration you're building and whether you're building project alone or a solution file containing the project.
Unsure if this is a bug, or if I'm misunderstanding how solution files work and this is intended.

To Reproduce

Clone repo: https://github.com/woodylaurence/DotNetBuildIssueRepro.git

Create solution file and add the Application project to it:
dotnet new sln --name "solution_file"
dotnet sln solution_file.sln add Application/Application.csproj

Then build solution file in Release configuration and try and publish Application in same configuration:
dotnet build solution_file.sln --configuration Release
dotnet publish Application/Application.csproj --configuration Release --no-build

Get the following error:

/usr/lib/dotnet/sdk/8.0.110/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(351,5): error MSB3030: Could not copy the file "/home/laurence/RiderProjects/DotNetBuildIssueRepro/LibraryProject/bin/Release/net8.0/LibraryProject.dll" because it was not found. [/home/laurence/RiderProjects/DotNetBuildIssueRepro/Application/Application.csproj]

bin/Release/net8.0 folder is empty after this step, hence the error.

If you instead build and publish Application in Debug configuration everything works:
dotnet build solution_file.sln --configuration Debug
dotnet publish Application/Application.csproj --configuration Debug --no-build

If you clean up and then only build the project, rather than the solution, everything works:
dotnet clean Application/Application.csproj --configuration Release && dotnet clean LibraryProject/LibraryProject.csproj --configuration Release
dotnet build Application/Application.csproj --configuration Release
dotnet publish Application/Application.csproj --configuration Release --no-build

Exceptions (if any)

See above error message.

Further technical details

dotnet --info output:
.NET SDK:
Version: 8.0.110
Commit: 87a66bb3d1
Workload version: 8.0.100-manifests.9143487c

Runtime Environment:
OS Name: ubuntu
OS Version: 24.04
OS Platform: Linux
RID: ubuntu.24.04-x64
Base Path: /usr/lib/dotnet/sdk/8.0.110/

.NET workloads installed:
Workload version: 8.0.100-manifests.9143487c
There are no installed workloads to display.

Host:
Version: 8.0.10
Architecture: x64
Commit: 81cabf2857

.NET SDKs installed:
8.0.110 [/usr/lib/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.10 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.10 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

1 participant