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

Visual Studio BUILD Copies DLL from a Referenced Project containing the DLL even when that DLL is Not Consumed in that Referenced Project #9574

Closed
garevaul opened this issue Oct 11, 2024 · 4 comments
Labels
Feature-Build-Acceleration Build Acceleration can skip calls to MSBuild within Visual Studio

Comments

@garevaul
Copy link

Hi @rainersigwald

This may be a Bug in Visual Studio BUILD.

Visual Studio IDE Build Copies DLL from a Referenced Project containing the DLL even when that DLL is Not Consumed in that Referenced Project. But Powershell DotNet Command Does Not Do That and works fine.

Because it is a slightly complicated issue, I have created an 8-minute Video Explaining the Issue (attached here).

I have also attached a Sample Visual Studio Project Solution that is explained in the Video.

MSBuild_Issue_For_Rainer.zip

Video...
https://1drv.ms/f/s!AjNAB3KpbqsErxfCNpurDPIj9iGA?e=LEbbqT

Regards
Bikramjeeth Garevaul

@GangWang01 GangWang01 self-assigned this Oct 17, 2024
@GangWang01
Copy link
Member

GangWang01 commented Oct 23, 2024

It is known from the provided video and sample that the issue happened to VS 17.11.5, but not reproduced with dotnet build command using dotnet 8.0.403 (associated msbuild version 17.11.9). The issue is that for the reference chain in .NET core project A -> project B -> assembly C and assembly C wasn't consumed by project B, building with VS at the first time didn't copy assembly C to project A's build output folder. But without any change building at the second time copied assembly C to project A's build output folder. Cleaning the solution could not delete assembly C from project A's build output folder.

I could reproduce with VS 17.11.5, not reproduce with msbuild.exe or dotnet build.
I found VS 17.11.5 had build acceleration enabled by default. After disabling it, I could not reproduce with VS. This is an issue of project system.

@GangWang01
Copy link
Member

@drewnoakes can you take a look and confirm if this is a known issue for build acceleration?

@garevaul
Copy link
Author

Hi @GangWang01 @drewnoakes

Yes, I have Disabled Build Acceleration by Default and Now it is Fine.

As I also pointed out, and you confirmed, it happens only in Visual Studio IDE.

The Command Line 'DotNet Build' works fine.

Thanx @GangWang01
@garevaul

@drewnoakes drewnoakes transferred this issue from dotnet/msbuild Oct 29, 2024
@drewnoakes drewnoakes added the Feature-Build-Acceleration Build Acceleration can skip calls to MSBuild within Visual Studio label Oct 29, 2024
@drewnoakes
Copy link
Member

Hi @garevaul, thanks for taking the time to research and report this issue so clearly. After some investigation I've created #9575 to track the difference in behaviour here. It'll be a tricky one to fix, so please comment there with more information on your use case to help us understand the impact of the bug.

In the meantime, if this is breaking any important scenarios for you then I recommend adding <AccelerateBuildsInVisualStudio>false</AccelerateBuildsInVisualStudio> in any project that you don't want the unreferenced DLL to be copied to.

I'll close this issue and we can continue the discussion in #9575.

Thanks again.

@drewnoakes drewnoakes closed this as not planned Won't fix, can't repro, duplicate, stale Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature-Build-Acceleration Build Acceleration can skip calls to MSBuild within Visual Studio
Projects
None yet
Development

No branches or pull requests

3 participants