I\'ve copied my project to a clean Windows 10 machine with only Visual Studio 2015 Community and SQL Server 2016 Express installed. There are no other framework versions ins
I had this, but, it was because I had added a NuGet package that had updated the binding redirects. Once I removed the package, the redirects were still there. I removed all of them, and then ran update-package -reinstall. This added the correct redirects.
If you have multiple projects in your solution, then right-click on the solution icon in Visual Studio and select 'Manage NuGet Packages for Solution', then click on the fourth tab 'Consolidate' to consolidate all your projects to the same version of the DLLs. This will give you a list of referenced assemblies to consolidate. Click on each item in the list, then click install in the tab that appears to the right.
Check .net framework version.
My original .net framework is older version.
After I installed .net framework 4.6, this issue is automatically solved.
You can fix this by upgrading your project to .NET Framework 4.7.2. This was answered by Alex Ghiondea - MSFT. Please go upvote him as he truly deserves it!
This is documented as a known issue in .NET Framework 4.7.1.
As a workaround you can add these targets to your project. They will remove the DesignFacadesToFilter from the list of references passed to SGEN (and add them back once SGEN is done)
<Target Name="RemoveDesignTimeFacadesBeforeSGen" BeforeTargets="GenerateSerializationAssemblies"> <ItemGroup> <DesignFacadesToFilter Include="System.IO.Compression.ZipFile" /> <_FilterOutFromReferencePath Include="@(_DesignTimeFacadeAssemblies_Names->'%(OriginalIdentity)')" Condition="'@(DesignFacadesToFilter)' == '@(_DesignTimeFacadeAssemblies_Names)' and '%(Identity)' != ''" /> <ReferencePath Remove="@(_FilterOutFromReferencePath)" /> </ItemGroup> <Message Importance="normal" Text="Removing DesignTimeFacades from ReferencePath before running SGen." /> </Target> <Target Name="ReAddDesignTimeFacadesBeforeSGen" AfterTargets="GenerateSerializationAssemblies"> <ItemGroup> <ReferencePath Include="@(_FilterOutFromReferencePath)" /> </ItemGroup> <Message Importance="normal" Text="Adding back DesignTimeFacades from ReferencePath now that SGen has ran." /> </Target>
Another option (machine wide) is to add the following binding redirect to sgen.exe.config:
<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.IO.Compression.ZipFile" publicKeyToken="b77a5c561934e089" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.0.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> This will only work on machines with .NET Framework 4.7.1. installed. Once .NET Framework 4.7.2 is installed on that machine, this workaround should be removed.
4.6.1-2 in VS2017 users may experience the unwanted replacement of their version of System.Net.Http by the one VS2017 or Msbuild 15 wants to use.
We deleted this version here:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\lib\System.Net.Http.dll
and here:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\lib\System.Net.Http.dll
Then the project builds with the version we have referenced via NuGet.
Change following:
<bindingRedirect oldVersion="0.0.0.0-4.1.1.2" newVersion="4.1.1.2" />
with the following:
<bindingRedirect oldVersion="0.0.0.0-4.1.1.2" newVersion="4.0.0.0" />
in web.config