VS 2019 Upgrade to 16.9.4 Causes Compile/Link Error

Lance, Michael B 16 Reputation points
2021-04-14T15:07:10.693+00:00

For a project that built this morning with VS 2019 16.9.3 I am getting a compile/link time error after upgrading to VS 2019 16.9.4:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(1480,5): error MSB3025: The source file "C:\MySource\MyLib\Debug\" is actually a directory. The "Copy" task does not support copying directories.

A check of Microsoft.CppCommon.targets for that line shows:

<Copy Condition="'%(ClCompile.ProgramDatabaseFileName)' != '$(OutDir)$(TargetName).pdb' and
                 ('%(ClCompile.DebugInformationFormat)' == 'ProgramDatabase' or '%(ClCompile.DebugInformationFormat)' == 'EditAndContinue') and
                 Exists(%(ClCompile.ProgramDatabaseFileName))" SourceFiles="%(ClCompile.ProgramDatabaseFileName)" DestinationFiles="$(OutDir)$(TargetName).pdb" />

There is clearly a file name and extension, $(TargetName).pdb, in the DestinationFiles:

$(OutDir)= "C:\MySource\MyLib\Debug\"
$(TargetName)= "MyLib"

It seems like the last part of DestinationFiles, "$(TargetName).pdb" is being ignored.

Again, the only change between successful build and unsuccessful build is the upgrade of VS 2019 from 16.9.3 to 16.9.4.

Update:

In looking at the error more, I realized the error reads "The source file...", which implies a problem with

SourceFiles="%(ClCompile.ProgramDatabaseFileName)"

Community Center | Not monitored
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,426 Reputation points
    2021-04-15T03:30:47.45+00:00

    Hi LanceMichaelB,

    I try to create a C++ console application with this command in 16.9.4, and macro value can be recognized as normal.
    87987-image.png

    Not sure if it is caused by caches, you can delete .vs folder, which is used to save the VS configuration of your project, then rebuild your project.

    Best Regards, Dylan

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our * *documentation* to enable e-mail notifications if you want to receive the related email notification for this thread.**

    1 person found this answer helpful.
    0 comments No comments

  2. Lance, Michael B 16 Reputation points
    2021-04-19T14:37:36.32+00:00
    1 person found this answer helpful.

  3. MossCro 6 Reputation points
    2021-04-17T07:52:27.49+00:00

    I am encountering the same issue.

    Deleting the .vs folder does not affect or solve the problem.

    The issue is in Microsoft.CppCommon.targets:

    <!-- make sure lib's pdb is near the lib -->
    <Copy Condition="'%(ClCompile.ProgramDatabaseFileName)' != '$(OutDir)$(TargetName).pdb' and
                     ('%(ClCompile.DebugInformationFormat)' == 'ProgramDatabase' or '%(ClCompile.DebugInformationFormat)' == 'EditAndContinue') and
                     Exists(%(ClCompile.ProgramDatabaseFileName))" SourceFiles="%(ClCompile.ProgramDatabaseFileName)" DestinationFiles="$(OutDir)$(TargetName).pdb" />
    

    The simplest way to fix the problem is to comment out this section, entirely:

    <!-- make sure lib's pdb is near the lib 
    <Copy Condition="'%(ClCompile.ProgramDatabaseFileName)' != '$(OutDir)$(TargetName).pdb' and
                     ('%(ClCompile.DebugInformationFormat)' == 'ProgramDatabase' or '%(ClCompile.DebugInformationFormat)' == 'EditAndContinue') and
                     Exists(%(ClCompile.ProgramDatabaseFileName))" SourceFiles="%(ClCompile.ProgramDatabaseFileName)" DestinationFiles="$(OutDir)$(TargetName).pdb" />  -->
    

    However, Microsoft really needs to fix this.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.