Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6745123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:09:59+00:00 2026-05-26T12:09:59+00:00

Is there a way to force MsBuild to output target dependency information in a

  • 0

Is there a way to force MsBuild to output target dependency information in a structured form similar to makedepend? I need this at the solution level for a solution containing C# and C++ projects. I’m not picky about the output format.

I’ve considered that the C# dependencies can be determined by processing the .csproj files and building a DAG. Likewise I could run an open-source makedepend on the C++ sources and go from there. I’m really trying not to roll my own here — this seems like something that MsBuild ought to be able to just do, if even for diagnostic purposes.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:10:00+00:00Added an answer on May 26, 2026 at 12:10 pm

    I solved this without too much yak shaving. Obviously MsBuild does have the dependency info during the build so my approach is to wrap the build with a custom target that writes the dependency to a .depends file:

    <?xml version="1.0" encoding="utf-8"?>
    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    
      <!-- Write project dependencies to a .depends file, one line per dependency -->
      <Target Name="OutputProjectDependencies">
        <Delete Files="$(OutputPath)\$(TargetFileName).depends"/>
        <WriteLinesToFile File="$(OutputPath)\$(TargetFileName).depends" 
          Lines="@(CscDependencies->'%(FullPath)');@(ReferencePath->'%(FullPath)');@(Content->'%(FullPath)');@(_NoneWithTargetPath->'%(FullPath)')"
          Overwrite="false"
          Encoding="UTF-8"/>
        <WriteLinesToFile File="$(OutputPath)\$(TargetFileName).depends" 
          Lines="@(ClDependencies->'%(FullPath)')"
          Overwrite="false"
          Encoding="UTF-8"/>
      </Target>
    
      <ItemGroup>
        <CscDependencies Include="@(Compile);@(EmbeddedResource)"/>
        <ClDependencies Include="@(ClCompile);@(ClInclude)"/>
      </ItemGroup>
    
      <PropertyGroup>
        <BuildDependsOn>
          $(BuildDependsOn);
          OutputProjectDependencies;
        </BuildDependsOn>
      </PropertyGroup>
    
    </Project>
    

    This is not quite as robust as I’d like for C++ projects (it lacks included header and link library dependencies) but could probably be further enhanced. I believe this is a very solid approach for C# — it includes referenced assemblies, embedded resources and content.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to force Solution Explorer in Visual Studio 2010 to sort
Is there a way to force the this keyword to act as a ref
Is there a way to force a non-secure form post to be secure? I
Is there a way to force a logoff (knowing this is not recommended) of
Is there a way to force a form to be active and shown? From
is there a way to force Qt4 to draw window frame similar to office
Is there a way to force the use of the this keyword in Visual
Is there any way to force a listview control to treat all clicks as
Is there any way to force an update of software using RunOnce, without having
Is there a way to force the flash garbage collector to clean up freed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.