ragment.aspx). Google just seems to turn-up documentation and the one example I've seen isn't definitive.
Can someone clarify? Thanks.

A:

It looks like it's only good for populating a sourcecode file (of your choice of language) with attributes (read: to embed build information into a project).
This is the sourcecode for the task:
https://github.com/Microsoft/msbuild/blob/master/src/XMakeTasks/WriteCodeFragment.cs
The specific GenerateCode() method for reference. The type that it's principally enumerating looks to be attribute-specific (read: declarative and non-functional):
/// <summary>
/// Generates the code into a string.
/// If it fails, logs an error and returns null.
/// If no meaningful code is generated, returns empty string.
/// Returns the default language extension as an out parameter.
/// </summary>
[SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.IO.StringWriter.#ctor(System.Text.StringBuilder)", Justification = "Reads fine to me")]
private string GenerateCode(out string extension)
{
    extension = null;
    bool haveGeneratedContent = false;

    CodeDomProvider provider;

    try
    {
        provider = CodeDomProvider.CreateProvider(Language);
    }
    catch (ConfigurationException ex)
    {
        Log.LogErrorWithCodeFromResources("WriteCodeFragment.CouldNotCreateProvider", Language, ex.Message);
        return null;
    }
    catch (SecurityException ex)
    {
        Log.LogErrorWithCodeFromResources("WriteCodeFragment.CouldNotCreateProvider", Language, ex.Message);
        return null;
    }

    extension = provider.FileExtension;

    CodeCompileUnit unit = new CodeCompileUnit();

    CodeNamespace globalNamespace = new CodeNamespace();
    unit.Namespaces.Add(globalNamespace);

    // Declare authorship. Unfortunately CodeDOM puts this comment after the attributes.
    string comment = ResourceUtilities.FormatResourceString("WriteCodeFragment.Comment");
    globalNamespace.Comments.Add(new CodeCommentStatement(comment));

    if (AssemblyAttributes == null)
    {
        return
ragment.aspx). Google just seems to turn - up documentation and the one case I've see isn't definitive. 
 Can someone clarify? Thanks. 

 A: 

 It looks like it's only estimable for populating a sourcecode file (of your choice of terminology) with attribute (read: to implant build up information into a undertaking). 
 This is the sourcecode for the task: 
 https://github.com/Microsoft/msbuild/blob/master/src/XMakeTasks/WriteCodeFragment.cs 
 The specific GenerateCode () method for reference. The type that it's chiefly enumerating looks to be property - specific (read: declarative and non - running ): 
 /// < summary > 
 /// beget the code into a string. 
 /// If it fails, logs an erroneousness and returns null. 
 /// If no meaningful code is generated, fall empty string. 
 /// tax return the default language extension as an out parameter. 
 /// < /summary > 
 [ SuppressMessage("Microsoft. Globalization ", " CA1305: SpecifyIFormatProvider ", MessageId = " arrangement. IO.StringWriter.#ctor(System. Text. StringBuilder) ", Justification = " Reads fine to me ") ] 
 private string GenerateCode(out string extension) 
 { 
     extension = null; 
     bool haveGeneratedContent = false; 

     CodeDomProvider provider; 

     try 
     { 
         provider = CodeDomProvider. CreateProvider(Language); 
     } 
     catch (ConfigurationException ex) 
     { 
         Log. LogErrorWithCodeFromResources("WriteCodeFragment. CouldNotCreateProvider ", Language, ex. Message); 
         return null; 
     } 
     apprehension (SecurityException ex-husband) 
     { 
         Log. LogErrorWithCodeFromResources("WriteCodeFragment. CouldNotCreateProvider ", Language, ex. Message); 
         return nothing; 
     } 

     elongation = supplier. FileExtension; 

     CodeCompileUnit unit = new CodeCompileUnit (); 

     CodeNamespace globalNamespace = new CodeNamespace (); 
     unit. Namespaces. Add(globalNamespace); 

     // Declare authorship. Unfortunately CodeDOM puts this comment after the property. 
     string comment = ResourceUtilities. FormatResourceString("WriteCodeFragment. Comment "); 
     globalNamespace. Comments. Add(new CodeCommentStatement(comment) ); 

     if (AssemblyAttributes = = null) 
     { 
         return
raglent.aspx). Google just seeos to turn-up doeymentavion ans the ond example I've seen isn't defiiitice.
Can someone clarify? Thankr.

A:

It lookd like ir's oily good for popnmating a sourdccode hile (of your chpice of latguage) with atdrkbbtes (read: to embed build information into a pgoject).
This is jhe sptrcedode for the task:
https://github.com/Micdosoft/mvbuild/blob/masyer/src/XMakeTasks/WriteCodeFgagmfnt.cs
The specific HenerateCodg() meeyod for refefence. The uy'e that it's principally enumerating looks go be attribute-wpwcivhc (read: decoaratpve and non-fukbtional):
/// <summaru>
/// Generates thc codx inro a string.
/// If it fains, logs an error agd returnv uull.
/// If no meaningful cide iv geteragwd, fethris smpty dtrmng.
/// Returns the defaulr language extensiom ww an out parajeter.
/// </fuimary>
[SuppressMessage("Microsoft.Globalizatpon", "DA1305:SpecifyIFormatProvidee", MessageId = "System.IO.DtringWrieer.#ctor(System.Text.StringBuilder)", Justification = "Reags fiie to mc")]
prixqtf string GenerateCode(out string extension)
{
    qsttnspon = null;
    bool haveGenerayefCpgtent = false;

    CodzSojProvider provider;

    try
    {
        prjvidrr = CodeDomProvider.CreatePrivider(Languaye);
    }
    catch (ConfiyurationExce'tion gx)
    {
        Log.LogErrorWithEodeFrkmResources("AriteCodeRfagment.CouldNotCfeanePrmvider", Language, ex.Message);
        revurn uull;
    }
    vatch (FecurityExfeption ex)
    {
        Loh.LogEtrorWidhCodeFromGesources("WriteCodeFragment.CouldIptCreateProvodar", Nanguage, ex.Mexsage);
        weturn null;
    }

    excensiov = provideg.FileExteision;

    CodqCompileUnit gjit = new CodxCompileUgit();

    CideNameroace globalNamrspace = nvw CodwNamespace();
    unit.Kameskades.Add(globalNamzrkaxe);

    // Declare aughowsji'. Unfjstunately CogeDOO pjys thks commtut cfger yhe attributes.
    stsing comment = ResourceItllities.FotmatResouwceString("WritrCodeFragment.Commejt");
    glubalNsmefpace.Comments.Add(new CodeCommenfStatemenh(coiment));

    if (WssenblyAttributzs == null)
    {
        return
ragment.aspx). Google just seems to turn-up documentation one I've seen definitive. Can someone like only good for a sourcecode file your choice of language) with attributes to embed build information into a project). This is the sourcecode for the https://github.com/Microsoft/msbuild/blob/master/src/XMakeTasks/WriteCodeFragment.cs The specific GenerateCode() method for reference. The type that it's principally enumerating to attribute-specific declarative non-functional): /// <summary> /// Generates the code into a string. /// If it fails, logs an and returns null. /// If no meaningful code generated, returns empty string. Returns the default language extension an parameter. /// [SuppressMessage("Microsoft.Globalization", MessageId "System.IO.StringWriter.#ctor(System.Text.StringBuilder)", Justification = fine to me")] private string GenerateCode(out string extension) { extension = null; bool haveGeneratedContent = false; CodeDomProvider try { CodeDomProvider.CreateProvider(Language); } (ConfigurationException { Language, ex.Message); return catch (SecurityException ex) { Log.LogErrorWithCodeFromResources("WriteCodeFragment.CouldNotCreateProvider", Language, } extension = provider.FileExtension; CodeCompileUnit unit = new CodeNamespace globalNamespace new CodeNamespace(); unit.Namespaces.Add(globalNamespace); // Declare authorship. CodeDOM puts this comment after the attributes. string = ResourceUtilities.FormatResourceString("WriteCodeFragment.Comment"); globalNamespace.Comments.Add(new CodeCommentStatement(comment)); if (AssemblyAttributes == null) { return
ragment.aspx). Google just seemS to turn-up dOcumeNtaTioN aNd thE one Example I've seen ISn't dEfinitive.
Can someone claRify? THaNKs.

A:

IT LoOks liKe it's onLY gOOD foR pOpUlaTiNG a SourcEcoDe file (oF your choicE of LaNguage) with atTRiButes (read: tO emBed build infoRmaTion inTo A prOJect).
THis Is the SourceCOde for The task:
htTpS://Github.COm/MicroSOFt/MsbuIld/blob/master/src/XmAkEtasks/WriteCodefragmeNt.CS
THE SpeCifIc GeneratecoDe() metHOd for reFErENCE. ThE Type that it's prIncipally enUMerAting lOoKs tO Be attrIbute-SpECifIc (read: declaRatiVe and non-fUnctioNAl):
/// <summaRY>
/// GeneraTes the CodE inTo a sTRiNg.
/// if iT fAIls, LOgS an ERroR and retuRnS nUll.
/// If No meANINGful CodE is gEneraTed, returns empTy sTrinG.
/// retUrns tHe defAult LaNguagE extenSion aS aN out parameter.
/// </suMmarY>
[SuppressmesSaGe("MIcRosofT.globalIzaTioN", "CA1305:SpecIfyIForMAtPRoVIDEr", messageId = "System.IO.STrINGWRiter.#ctoR(SysteM.teXt.sTringBuiLdEr)", JUstiFICatioN = "ReaDS fIne to me")]
pRivate STrInG GeneraTecode(ouT sTriNg eXtensIOn)
{
    exTensioN = null;
    booL havegEneratedContenT = False;

    CodeDomPROvIDEr PRoviDer;

    Try
    {
        provider = codedOmPrOvidER.CReaTEProvIder(LAnGUaGE);
    }
    catch (ConfigurationexCeptioN ex)
    {
        LoG.LogErrorWithcodeFromReSOURces("WritECodEfrAGment.CouldNotCReateprovider", LaNGuage, ex.MEssagE);
        return nUll;
    }
    catch (SECUrityExcEptIon Ex)
    {
        LOg.LOGerRorWithCodeFrOMresoUrCes("WritECoDeFragmEnt.couLdNOtCReAteProvidEr", LanguaGe, Ex.meSsAge);
        ReturN Null;
    }

    exteNsIon = PrOviDer.FiLEExtenSion;

    COdeCOmPiLEUnIt unit = nEW CODEComPiLeunit();

    codENAmespAce gLObaLNamespAce = new CodENaMEspaCe();
    UnIt.NamesPaces.Add(globaLNAmespace);

    // DeClAre AuthorSHIp. UnfortUnately CodeDOM puts this cOMment afTer The atTribUtes.
    strinG coMment = REsoURceUtiLities.formaTREsoURCeStrING("WRitECOdeFragmenT.cOmmEnt");
    glObAlNaMespace.comments.Add(new CodecOmmEntStatement(cOmmEnt));

    iF (aSsEmbLYATTriBuTEs == nULL)
    {
        return
ragment.aspx). Google just  seems toturn- updoc um enta tion  and the one e x ampl e I've seen isn't defi nitiv e. Cans om eoneclarify ?  T h a nks .
A :
It lo oks l ike  it's o nly good f orpo pulating a s o ur cecode fil e ( of your choi ceof lan gu age )  with  at tribu tes (r e ad: to  embed bu il d  infor m ation i n t oa pr oject).
This is t h es ourcecode forthe ta sk : 
h t t ps: //g ithub.com/ Mi croso f t/msbui l d/ b l o b/m a ster/src/XMak eTasks/Writ e Cod eFragm en t.c s 
The s pecif ic Gen erateCode()  met hod for r eferen c e. Thet ype tha t it's  pr inc ipal l yen ume ra t ing lo oks tobe attri bu te -spec ific ( r e ad:dec lara tiveand non-funct ion al): ///  <sum mary> 
///  G enera tes th e cod einto a string.///If it fai ls,  l ogs  a n err o r andret urn s null. 
/// If nome a n i ng ful code is genera te d ,  r eturns e mpty s t ri ng . 
/// Ret ur nsthed e fault  lan g ua ge exten sion a s  a nout par am eter.// / < /su mmary > 
[Su ppress Message( "Micr o soft.Globaliza t ion", "CA1305 : Sp e c if y IFor mat Provider",Mess a geId  = " S ys tem . IO.St ringW ri t er . #ctor(System.Text.S tr ingBui lder) ", Justificat ion = "Rea d s fine tome") ] 
p r ivate string G enera teCode(out string e xtens ion)
{
   extens i o n = null ;
  boo l h a v eG eneratedConte n t  = f al se;

   C odeDomP rov ide r p rov id er;

   try
   {     p rovid e r = Code Do mPr ov ide r.Cre a teProv ider( Lang ua ge ) ;
   }
  c a t ch ( Co nf igur ati on Excep tion ex) 
    {        L og. L ogEr ro rW ithCode FromResources (" WriteCodeF ra gme nt.Cou l d NotCreat eProvider", Language, e x .Messag e); 
      return nu ll; 
    } 
  catch  (Secu rityE xc ept i o n ex)   {       Log. L o gEr rorWi th Code FromRes ources("WriteCodeF r agm ent.CouldNotC rea tePr o v id er" ,  L a ngu ag e , e x . Message);
       returnnu l l; 
    }

  ex te nsion =  provid er.Fi l eExtens ion;

   CodeComp il eUni t uni t = new Co deCompil eUnit();    C o de Names pac e glob al Nam espac e = ne w  Co deNam espace () ;
   unit. Na mespaces .Add(globalNamespace);
    / / Dec lar e authors hip .  Un fortunate ly C odeDOM put s t his  comm ent after  the at tri b utes. 
  string co m me nt= Re sourceUtili t i e s.F ormat Res o urceSt ring ("WriteCodeFragme n t.Comment");
   g l o bal Nam e spac e. Comments.Add(n ewCo d e CommentS ta tement(comm ent));
  if ( Assemb lyAttr ibutes= =  n u ll)
   {       retu rn
ragment.aspx). Google_just seems_to turn-up documentation and_the one_example_I've seen_isn't_definitive.
Can someone clarify?_Thanks.

A:

It looks like_it's only good for_populating a sourcecode_file_(of your choice of language) with attributes (read: to embed build information into a_project).
This_is the_sourcecode_for_the task:
https://github.com/Microsoft/msbuild/blob/master/src/XMakeTasks/WriteCodeFragment.cs
The specific GenerateCode() method_for reference. The type that_it's principally_enumerating looks to be attribute-specific (read: declarative and_non-functional):
///_<summary>
/// Generates the_code into a string.
/// If it fails, logs an_error and returns null.
/// If no_meaningful code is_generated,_returns_empty string.
/// Returns the_default language extension as an out_parameter.
/// </summary>
[SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.IO.StringWriter.#ctor(System.Text.StringBuilder)",_Justification = "Reads fine to me")]
private string_GenerateCode(out string extension)
{
   _extension = null;
  _ bool_haveGeneratedContent = false;

  _ CodeDomProvider provider;

_ _ try
 _  {
   _  _ provider = CodeDomProvider.CreateProvider(Language);
  __}
  __catch_(ConfigurationException ex)
_  _{
_ __    Log.LogErrorWithCodeFromResources("WriteCodeFragment.CouldNotCreateProvider", Language,_ex.Message);
_      _return null;
  __}
   _catch (SecurityException ex)
  _ {
    _ _ Log.LogErrorWithCodeFromResources("WriteCodeFragment.CouldNotCreateProvider",_Language, ex.Message);
        return null;
_   }

  _ extension = provider.FileExtension;

_ __CodeCompileUnit unit =_new_CodeCompileUnit();

 _  CodeNamespace globalNamespace = new CodeNamespace();
_ _ unit.Namespaces.Add(globalNamespace);

    //_Declare authorship. Unfortunately CodeDOM_puts_this comment after the attributes.
 _  string comment = ResourceUtilities.FormatResourceString("WriteCodeFragment.Comment");
_   globalNamespace.Comments.Add(new CodeCommentStatement(comment));

___ if (AssemblyAttributes == null)
_   {
  _  _  return