Cannot generate serialization assembly {AssemblyName}.XmlSerializers.dll because it already exists. Use /force to force an overwrite of the existing assembly.

Posted: July 15, 2013 in BizTalk
Tags: , , , , ,

For some reason after having migrated a BizTalk 2006/Visual Studio 2005 solution to BizTalk 2010/VS 2010 using Visual Studio Conversion Wizard, I got the following error:

"Cannot generate serialization assembly {AssemblyName}.XmlSerializers.dll because it already exists. Use /force to force an overwrite of the existing assembly"

SGEN-Cannot-generate-serialization-assembly-XmlSerializers

The migration of this project was divided into two parts:

  • First part is to migrate the project as is to the new environment in order to discontinue the old platform;
  • The second part is to improve the project with new functionalities available in the new version (migrate SOAP adapter to WCF and so on);

CAUSE

The XML Serializer Generator creates an XML serialization assembly for types in a specified assembly in order to improve the startup performance of a XmlSerializer when it serializes or deserializes objects of the specified types.

However, some time if you have a traditional Web Service reference in your BizTalk Project this error may suddenly appear. It seems that when you try to build the solution the SGEN process is having some trouble deleting the original XMLSerializers.dll and in result will give you that error.

SOLUTION 1

This problem can be solved by:

  • Going to the path “%windir%\Microsoft.NET\assembly\” (.NET 4.0) or “C:\WINDOWS\assembly” (if you use previous version of .NET) and uninstall the corresponding Project name DLL from there.
  • And then rebuild the Project.

Limitation: each time you deploy the DLL to the GAC, the next time you need to build the project you first need to uninstall the DLL from the GAC

SOLUTION 2

You also can solve this error by choosing not to generate a Serializiation assembly from the Project Properties.

  • Right-click in the project name and select “Properties” option
  • On the left tree option choose “Build” tag
  • Under the Output properties, from the drop box “Generate serialization assembly” select “Off”

Visual-Studio-Project-Properties-Generate-serialization-assembly-off

Comments
  1. Howard Edidin says:

    Valuable information. I have run into the issue several times.

  2. Falcon says:

    Greate, it worked,, thanks

  3. Anonymous says:

    thanks

  4. Omar says:

    Many thanks for this share.

  5. Omar says:

    In my case, i had to restart the server and than add the missing DLL to the Resources folder of the Application.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s