MSBuild Task for setting custom attribute in AssemblyInfo.cs

Is there a MSBuild task for setting custom attribute in AssemblyInfo.cs? I found AssemblyInfo task but it seems that it cannot set custom attributes, only predefined ones. I'd like to set 3 custom properties I have added into this file.

Any suggestion how to solve this?

Answers


WriteCodeFragment task can help:

<Target Name="BeforeBuild">
    <ItemGroup>
     <AssemblyAttributes Include="AssemblyTitle">
        <_Parameter1>My Assembly</_Parameter1>
     </AssemblyAttributes>
     <AssemblyAttributes Include="AssemblyDescription">
        <_Parameter1>My Assembly</_Parameter1>
     </AssemblyAttributes>  
     <AssemblyAttributes Include="AssemblyCompany">
        <_Parameter1>My Company</_Parameter1>
     </AssemblyAttributes>
     <AssemblyAttributes Include="AssemblyProduct">
        <_Parameter1>My Product</_Parameter1>
     </AssemblyAttributes>
     <AssemblyAttributes Include="AssemblyCopyright">
        <_Parameter1>Copyright © 2012</_Parameter1>
     </AssemblyAttributes>
     <AssemblyAttributes Include="AssemblyCulture">
        <_Parameter1></_Parameter1>
     </AssemblyAttributes>       
     <AssemblyAttributes Include="AssemblyVersion">
        <_Parameter1>1.0.0.0</_Parameter1>
     </AssemblyAttributes>   
     <AssemblyAttributes Include="AssemblyFileVersion">
        <_Parameter1>1.0.0.0</_Parameter1>
     </AssemblyAttributes>
     <AssemblyAttributes Include="System.Runtime.InteropServices.Guid">
        <_Parameter1>e7a979b2-0a4f-483a-ba60-124e7ef3a931</_Parameter1>
     </AssemblyAttributes>
    </ItemGroup>
  <WriteCodeFragment Language="C#" OutputFile="Properties/AssemblyInfo.cs" AssemblyAttributes="@(AssemblyAttributes)" />
</Target>

Need Your Help

SlickGrid button click handler stops functioning on scroll event?

javascript jquery slickgrid

In attempting to use SlickGrid in my page, I have noticed that a jQuery click handler I declare after the grid is rendered only works for approximately 2x the number of rows visible.

Sharepoint multi-column validation

c# validation list sharepoint sharepoint-2010

I've got a custom list that contains multi collumns. The validation is made by a custom contenttype. Now I want a combination of two columns to be unique. Until know I did not found a way to solve ...