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

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 an XmlSerializer when it serializes or deserializes objects of the specified types.

However, sometimes 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 the 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 Serialization assembly from Project Properties.

  • Right-click on 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
Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

BizTalk360
BizTalk Server

Over 500+ customers across
30+ countries depend on BizTalk360

Learn More
Serverless360
Azure

Manage and monitor serverless
components effortlessly

Learn More
Atomicscope
Business Users

Monitor your Business Activity in iPaaS
or Hybrid integration solutions

Learn More

Back to Top