Closed bwilliams1 closed 3 years ago
@bwilliams1 The ability to double click the error and have VS update the redirects doesn't work (as you found). What it does do, on compile, is generate an AssemblyName.dll.config file in the bin folder. In the case of a web application this doesn't really solve the problem, but you can cut and paste the assembly binding section from that file. It is based on the web.config file, so you can actually just copy the file over the top of web.config, or setup a target to do so.
<Target Name="UpdateWebConfigBindingRedirects" AfterTargets="CopyFilesToOutputDirectory">
<Copy SourceFiles="$(OutDir)$(AssemblyName).dll.config" DestinationFiles="web.config" />
</Target>
This has some minor drawbacks, and may confuse your source control as the file will be overwritten on each build, but it does work.
I guess that maybe we need to add a wiki entry or some more documentation for this project to cover a few things like this, MvcBuildViews
and how to compile and publich your project under CI.
I welcome anyone to contribute to the project, either with updates or documentation.
For reference, I added a wiki page for this Autogenerating Binding Redirects
I noticed when the solution has conflicting versions of nuget packages, instead of prompting as described here
it shows the error
Warning MSB3276 Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190. <project name here> C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets 2182
which is odd because in the templates it looks like you already have that property set to true.
how did you generate the binding redirects seen in the samples?