Asked by:
Merged .winmd file causes that Visual Studio shows "This project is out of date" error message

Question
-
I'm trying to make a Windows Runtime component with help of pure C++, WRL and COM.
In process of component's compilation, .winmd metadata file is created. But in order to make it correctly usable by other projects it must be modified with help of mdmerge tool. After that the new metadata file must to replace the old version of it. This can be made by adding a custom build step.
The sample of what I'm telling can be found in the project provided by Microsoft: https://code.msdn.microsoft.com/windowsapps/Creating-a-Windows-Runtime-6c399797
Here is the command from custom build step from this sample project (WRLInProcessWinRTComponent_server):
Command Line: mdmerge -partial -i "$(OutDir)." -o "$(OutDir)Output" -metadata_dir "$(WindowsSDK_MetadataPath)" && copy /y "$(OutDir)Output\*" "$(OutDir)" Outputs: $(OutDir)%(TargetName).winmd Execute After: Midl
After all of these operations WinRT component can be consumable by other projects without errors.
But there is a problem which I have in my project and which can be also reproduced in the sample from above: Visual Studio begins to show "This project is out of date" message when trying to run debugging of projects which are dependent on WinRT component.
There are also errors in the build log:
Project 'WRLInProcessWinRTComponent_client_cs' is not up to date. Input file 'd:\samples\creating a windows runtime dll component\c# and c++ and javascript\debug\wrlinprocesswinrtcomponent_server\microsoft.sdksamples.kitchen.winmd' is modified after output file 'd:\Samples\Creating a Windows Runtime DLL component\C# and C++ and JavaScript\CS\bin\x86\Debug\WRLInProcessWinRTComponent.pdb'.
But in fact microsoft.sdksamples.kitchen.winmd modification date is older than such date of WRLInProcessWinRTComponent.pdb.
How to fix the problem?- Edited by Alexey Belyansky Wednesday, March 4, 2015 7:53 PM
Wednesday, March 4, 2015 1:56 PM
All replies
-
Hi Alexey,
Let's make the scenario easier, we have WINRT component A and B, and we have A.winmd also B.winmd, by using mdmerge Tool also your script, a new A.winmd is created, but note at the same time A.pdb and B.pdb still exist.
Now we reference the A.winmd from another project C, when we run the app C, C use A.winmd without any problem but when we debug project C, C is seeking for A.pdb while using A.winmd, but at this moment, A.winmd is a combination of A.winmd and B.winmd, A.pdb is still for A.winmd. That's why we get the problem of pdb and winmd not match.
Besides I would guess if we referencing the merged *.winmd file instead of referencing the windows component project, would it be better? Anyway the key reason is pdb and winmd does not match.
--James
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.
- Edited by Jamles HezModerator Thursday, March 5, 2015 6:56 AM
Thursday, March 5, 2015 6:04 AMModerator -
Thanks for your answer.
I've disabled .pdb generation (/DEBUG linker option is removed) for my WinRT component (component A in your example). If I correctly understood your answer, if there is no .pdb than there is no problem and Visual Studio should to stop showing error message. But if fact I continue to see that message.
Additionally I want to point on the build log message in my first post. If we project this message on your example with A, B, C than the message said that A.winmd is modified after C.pdb. Maybe I'm missing something, but this is strange and doesn't match with your assumptions.Thursday, March 5, 2015 8:53 AM -
Besides I would guess if we referencing the merged *.winmd file instead of referencing the windows component project, would it be better?
It's not a very good option. I want to have automatic build of all dependent projects/components. And in case of referencing the merged .winmd file I need to remember to rebuild component manually if some changes were really made.
Thursday, March 5, 2015 9:02 AM