MSB3247 diagnostic code
This article describes the MSB3247 error code.
Message text
MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the 'runtime' node in the application configuration file:
Remarks
This error occurs when building .NET Framework projects. It is generated by the ResolveAssemblyReference
task. There are two modes that ResolveAssemblyReference
can run in, either it can be configured to generate binding redirects, or not. If not set, this error occurs when a conflict occurs between two different assembly versions of dependent assembly.
Resolution
Consider the following solutions:
Solution 1: Configure MSBuild to automatically generate binding redirects
Check the property AutoGenerateBindingRedirects
, which configures ResolveAssemblyReference
to generate the redirects automatically. You can set this property in Visual Studio. Open Project Properties (Alt+Enter), open the Application tab, and select the checkbox Auto-generate binding redirects.
Or, to generate binding redirects automatically by editing the project file, add the following property in one of the PropertyGroup
elements in the project file:
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
See Enable and disable automatic binding redirection.
Solution 2: Add binding redirects to the app.config
or web.config
file
You can add the binding redirects manually in the configuration file (such asapp.config
or web.config
) as suggested in the warning output text. This option is appropriate if you choose not to allow MSBuild to generate the binding redirects automatically, perhaps because you want them explicitly listed in the configuration files to reduce ambiguity.
If you choose not to generate binding redirects automatically, update the app.config
file (or web.config
) to add the binding redirects explicitly. The warning message provides the XML for the binding redirects that you can copy and paste into the runtime
element of the app.config
file.
Alternately, MSBuild writes binding redirects to an output file if the property GenerateBindingRedirectsOutputType
is true. It's automatically set to true in the .NET Framework build for executable output files, but you can also set it to true manually for .dll
output. When MSBuild generates the binding redirects, it adds them to a .config
file in the output directory, which also contains any binding redirects found in the app.config
or web.config
file. You can copy the binding redirects from there and paste the XML into an app.config
file under the runtime
element if you want them to be explicitly visible there, or if you don't want MSBuild to generate them automatically.
See Troubleshooting assembly references.
Related content
Applies to
All versions of MSBuild