locked
Error while trying to build project -- build error MSB4067 RRS feed

  • Question

  • Hello,

    The following error occurs when I build a solution under any configuration other than debug:

      c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(2024,40): error MSB4067: The element <#text> beneath element <SGen> is unrecognized.

    Here is the offending portion of microsoft.common.targets:

      <Target
        Name="GenerateSerializationAssemblies"
        Condition="'$(_SGenGenerateSerializationAssembliesConfig)' == 'On' or ('@(WebReferenceUrl)'!='' and '$(_SGenGenerateSerializationAssembliesConfig)' == 'Auto')"
        DependsOnTargets="AssignTargetPaths;Compile;ResolveKeySource"
        Inputs="$(MSBuildAllProjects);@(IntermediateAssembly)"
        Outputs="$(IntermediateOutputPath)$(_SGenDllName)">
    
        <SGen
          BuildAssemblyName="$(TargetFileName)"
          BuildAssemblyPath="$(IntermediateOutputPath)"
          References="@(ReferencePath)"
          ShouldGenerateSerializer="$(SGenShouldGenerateSerializer)"
          UseProxyTypes="$(SGenUseProxyTypes)"
          KeyContainer="$(KeyContainerName)"
          KeyFile="$(KeyOriginatorFile)"
          DelaySign="$(DelaySign)"
          ToolPath="$(SGenToolPath)">
          
          SerializationAssembly="$(IntermediateOutputPath)$(_SGenDllName)"
    
          <Output TaskParameter="SerializationAssembly" ItemName="SerializationAssembly"/>
    
        </SGen>
    
      </Target>
    
    

    The project in question is over a year old. The error in question just recently began occurring. Other projects in the solution are unaffected and this project builds in debug mode. This is c# using Microsoft Visual Studio 2008 / Version 9.0.30729.1 SP / Microsoft .NET Framework /Version 3.5 SP1.

    Thank you.

     

     

    Friday, January 28, 2011 7:13 PM

Answers

  • You should compare this file with a computer which has it working. It has been corrupted as you appear to have this line in it:

     

       SerializationAssembly="$(IntermediateOutputPath)$(_SGenDllName)"
    

    Replace the file with a working version of the file

    Mike


    Visual Studio ALM MVP
    My Blog | MSBuild Extension Pack | MSBuild Explorer
    • Marked as answer by poolboi Thursday, February 17, 2011 10:12 PM
    Monday, January 31, 2011 9:25 AM
  • Shortly after posting the question, I commented out the following line:

     SerializationAssembly="$(IntermediateOutputPath)$(_SGenDllName)"


    This seems to have solved the issue. Sorry I did not post this sooner as I was not aware that anyone had responded.

     

    Thank you.

    • Marked as answer by poolboi Thursday, February 17, 2011 10:12 PM
    Thursday, February 17, 2011 10:12 PM
  • One more thing.

    I think I understand a little more clearly what may have happened. It seems that this line

       SerializationAssembly="$(IntermediateOutputPath)$(_SGenDllName)"

    is needed in the microsoft.common.targets file when "System.Xml.Serialization" is used by the project.

     

    Here is what I think happened:

    • I started using System.Xml.Serialization in the xbap project
    • Something automatically added the offending line to the microsoft.common.targets without changing the date of the file
    • My project stopped "building" (it still compiled) because of the new entry
    • I commented the line out
    • Project began building ok, but once published to server would no longer deploy down to users with an "XmlSerializers.dll.deploy did not succeed" message

     

    The ultimate fix is to have the line in the microsoft.common.targets file, but to have it in the correct location, as shown:

      <SGen
    BuildAssemblyPath="$(IntermediateOutputPath)"
    BuildAssemblyName="$(TargetFileName)"
    References="@(ReferencePath)"
    ShouldGenerateSerializer="$(SGenShouldGenerateSerializer)"
    UseProxyTypes="$(SGenUseProxyTypes)"
    KeyContainer="$(KeyContainerName)"
    KeyFile="$(KeyOriginatorFile)"
    DelaySign="$(DelaySign)"
    ToolPath="$(SGenToolPath)"
    SerializationAssembly="$(IntermediateOutputPath)$(_SGenDllName)"
    >


    <Output TaskParameter="SerializationAssembly" ItemName="SerializationAssembly"/>

    </SGen>
    That is, with the line as an attribute of the element.

     

     

    • Marked as answer by poolboi Thursday, February 17, 2011 10:51 PM
    Thursday, February 17, 2011 10:50 PM

All replies

  • Hi Poolboi,

     

    Thanks for your post.

    Since other projects in the solution are unaffected, I think there is something wrong in your csproj file is invalid,

    for instance, you set an item with property's syntax as:

    http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/2933768d-a5ef-4628-831d-45aed2be98e3

    or something similar.

    Could you please double check the csproj file and let me know the result?

    Hope my reply helps solve your issue.

     

    Best Regards,

    Ziwei Chen

     

    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

     

     


    Ziwei Chen [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 31, 2011 6:23 AM
  • You should compare this file with a computer which has it working. It has been corrupted as you appear to have this line in it:

     

       SerializationAssembly="$(IntermediateOutputPath)$(_SGenDllName)"
    

    Replace the file with a working version of the file

    Mike


    Visual Studio ALM MVP
    My Blog | MSBuild Extension Pack | MSBuild Explorer
    • Marked as answer by poolboi Thursday, February 17, 2011 10:12 PM
    Monday, January 31, 2011 9:25 AM
  • Shortly after posting the question, I commented out the following line:

     SerializationAssembly="$(IntermediateOutputPath)$(_SGenDllName)"


    This seems to have solved the issue. Sorry I did not post this sooner as I was not aware that anyone had responded.

     

    Thank you.

    • Marked as answer by poolboi Thursday, February 17, 2011 10:12 PM
    Thursday, February 17, 2011 10:12 PM
  • One more thing.

    I think I understand a little more clearly what may have happened. It seems that this line

       SerializationAssembly="$(IntermediateOutputPath)$(_SGenDllName)"

    is needed in the microsoft.common.targets file when "System.Xml.Serialization" is used by the project.

     

    Here is what I think happened:

    • I started using System.Xml.Serialization in the xbap project
    • Something automatically added the offending line to the microsoft.common.targets without changing the date of the file
    • My project stopped "building" (it still compiled) because of the new entry
    • I commented the line out
    • Project began building ok, but once published to server would no longer deploy down to users with an "XmlSerializers.dll.deploy did not succeed" message

     

    The ultimate fix is to have the line in the microsoft.common.targets file, but to have it in the correct location, as shown:

      <SGen
    BuildAssemblyPath="$(IntermediateOutputPath)"
    BuildAssemblyName="$(TargetFileName)"
    References="@(ReferencePath)"
    ShouldGenerateSerializer="$(SGenShouldGenerateSerializer)"
    UseProxyTypes="$(SGenUseProxyTypes)"
    KeyContainer="$(KeyContainerName)"
    KeyFile="$(KeyOriginatorFile)"
    DelaySign="$(DelaySign)"
    ToolPath="$(SGenToolPath)"
    SerializationAssembly="$(IntermediateOutputPath)$(_SGenDllName)"
    >


    <Output TaskParameter="SerializationAssembly" ItemName="SerializationAssembly"/>

    </SGen>
    That is, with the line as an attribute of the element.

     

     

    • Marked as answer by poolboi Thursday, February 17, 2011 10:51 PM
    Thursday, February 17, 2011 10:50 PM