title: Include files in .csproj using MSBuild
body: <p>I have a MSBuild script that realizes some operations before compiles a solution that have many projects.<br>
  I need to include a file (SharedAssemblyInfo_$(ambiente).cs) created during the process in every project Properties folder.<br><br>
  Any clues to resolve this?<br><br>
  Thanks in advance!</p>
  
  <p>PS.: Here is my script:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"&gt;
    &lt;Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" /&gt;
    &lt;Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /&gt;
    &lt;Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets"/&gt;
  
    &lt;ItemGroup&gt;
      &lt;Solution Include="Stoque.ECM.sln" /&gt;
  
      &lt;Compile Include="..\SharedAssemblyInfo_$(ambiente).cs"&gt;
          &lt;Link&gt;Properties\SharedAssemblyInfo_$(ambiente).cs&lt;/Link&gt;
      &lt;/Compile&gt;
  
    &lt;/ItemGroup&gt;
    &lt;PropertyGroup&gt;
      &lt;TMaior&gt;2&lt;/TMaior&gt;
      &lt;TMedio&gt;0&lt;/TMedio&gt;
      &lt;TMenor&gt;0&lt;/TMenor&gt;
  
      &lt;DeployDir&gt;E:\compartilhada\abaris&lt;/DeployDir&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;Target Name="GetProjects"&gt;
      &lt;GetSolutionProjects Solution="%(Solution.Fullpath)"&gt;
        &lt;Output ItemName="ProjectFiles" TaskParameter="Output" /&gt;
      &lt;/GetSolutionProjects&gt;
    &lt;/Target&gt;
  
    &lt;Target Name="AssemblyVersion"&gt;
      &lt;Time Format="yyMMdd"&gt;
        &lt;Output TaskParameter="FormattedTime" PropertyName="TRevisao" /&gt;
      &lt;/Time&gt;
      &lt;AssemblyInfo CodeLanguage="CS" OutputFile="..\SharedAssemblyInfo_$(ambiente).cs" AssemblyVersion="$(TMaior).$(TMenor).*" AssemblyFileVersion="$(versao)" AssemblyInformationalVersion="$(versao)" /&gt;   
      &lt;!-- &lt;Copy SourceFiles="..\SharedAssemblyInfo_$(ambiente).cs" DestinationFolder="%(ProjectFiles.Filename)\Properties" ContinueOnError="false" /&gt; --&gt;
    &lt;/Target&gt;
  
    &lt;Target Name="Compile" DependsOnTargets="GetProjects"&gt;
      &lt;MSBuild Projects="%(ProjectFiles.Fullpath)"
      Properties="WebProjectOutputDir=$(DeployDir)\$(ambiente)\$(versao)\SITES_PUBLICADOS\%(ProjectFiles.Filename);Platform=$(Platform);Configuration=$(Configuration);OutputPath=$(DeployDir)\$(ambiente)\$(versao)\%(ProjectFiles.Filename)"&gt;
      &lt;/MSBuild&gt;
    &lt;/Target&gt;
  
  &lt;/Project&gt;
  </code></pre>