-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[Bug] vcxproj ProjectReference from csproj triggers a build of the vcxproj but does not copy the target when modified #9841
Comments
I can reproduce a different behavior with MSBuild in command line.
Notice there is an 'incrementral clean' but it doesnt copy the native dll after ? |
@GangWang01 Could you repro this issue? We suspect it might be an up-to-date check problem. |
It's easy to reproduce with the provided solution https://github.com/fforjan/CSProjectAndVcxprojReferences. As the issue mentioned, I reproduced and attached binlogs binlogs.zip.
|
Is the NativeDLL a CLI project? If it is not, it should not be returning from GetTargetPath. |
@yuehuang010 no it is a C++ library project - not sure what you mean by CLI ? - and follows https://stackoverflow.com/a/42507529 to allow copying its output to the C# project. |
I am leaning toward NativeDll getting copied in VS as a bug. A C# project wouldn't know what to do with a C++ output. I think the csproj has another mechanism of fetching it via the Traversal copy that has to be opt-in. It should fetching the BuildOutputGroup target. |
The stack overflow link as an interesting description about why it should work. But if you have a different settings I'm happy to try. |
@rainersigwald can you help to take a look? Note that there are different problems when building with VS and msbuild.exe. |
@GangWang01 let me know if you have any update |
@surayya-MS any update on your side ? |
@surayya-MS ping ! |
Thanks for filing this bug @fforjan! |
I believe the issue is that the .vcxproj "Build" target does not return the primary build output, but the "GetTargetPath" target does.
|
I'm able to work around this with the following ProjectReference:
|
In the past, vcxproj project don't return its native output because RAR has issues processing them. Perhaps that has changed, in which case, add it would be an option. |
It does seem to me that Build and GetTargetPath should at least be consistent with each other, if the .csproj can call either one depending on the value of BuildProjectReferences. |
@JoshuaRoweMsft would you be able to try to update my sample to confirm it is working for you ? (i may only have time only on Friday this week) |
@JoshuaRoweMsft I tried the workaround, although it builds the project, the DLL is NOT copied to the .net project bin folder. |
I close this ticket as a dupe for that one: |
Issue Description
Whe csproj references a vcxproj updated to copy the native dll to the .net folder, the initial build will copy the dll but any subsequent build triggered from the C# project following a modification to of the C++ will not copy the output.
Note that the option that building the solution is not acceptable, we have this type of issue into a large solution when a unit tests refrecnes a native DLL and the developer usually build the unit test project only.
Steps to Reproduce
Notice that the NativeDll.dll is copied into the output folder, both for net472 and net80
Expected Behavior
As one the initial build, if any projectreference is updated, the dll must be copied over ?
Actual Behavior
Notice the the NativeDLL.dll is NOT updated into the output folder while the NativeDLL compilation was triggered.
Analysis
No response
Versions & Configurations
Reproduced with Microsoft Visual Studio Enterprise 2022 (64-bit) - Version 17.9.2
The text was updated successfully, but these errors were encountered: