MSBuild to copy dynamically generated files as part of project dependency

前端 未结 5 1936
青春惊慌失措
青春惊慌失措 2020-12-01 14:40

I have a custom msbuild task that is generating some output files to the output directory ($(TargetDir)) of a ProjectA. Current code is something like this:

         


        
5条回答
  •  死守一世寂寞
    2020-12-01 15:03

    Something like this seems to work, either include it manually into ProjectA's .csproj (keep in mind VS has a bad habit of occasionally resolving wildcards into absolute paths and overwriting .csproj) or inject dynamically by the custom task itself. Also, VS caches itemgroups on open, so it might not copy the files or fail the build if they were there but deleted. In that case projects need to be reloaded or VS restarted for itemgroups to be reevaluated. MSBuild, TFS, etc should always work.

    
      
        %(Filename)%(Extension)
        PreserveNewest
      
    
    

提交回复
热议问题