Я только что добавил Automapper в свое приложение asp.net (.net Framework 4.7), чтобы увидеть, как я надеюсь, возможность заменить некоторые утомительные ручные сопоставления, которые мне всегда нужно делать.
У меня сейчас много проблем с версиями System.ValueTuple.Я замечаю, что у меня есть пакет nuget для System.ValueTuple v4.5.0
.Если я смотрю в свои решения packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll
, я вижу это как версию 4.6.26515.06.Если я смотрю в один из проектов, у меня есть этот пакет nuget (тот, к которому я добавил Automapper), однако, когда я смотрю в своей папке bin
после сборки, у меня есть версия 4.6.25514.4
, т.е.пакет nuget имеет
Когда я собираю приложение на сборочном компьютере, он получает 4.6011.3
.Еще одна версия !!!
Я не могу удалить пакет nuget, так как он говорит, что Automapper зависит от него.
Когда пользователь запускает приложение, он выходит на желтый экран смерти,с
Could not load file or assembly 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Кто-нибудь знает, как отсортировать этот System.ValueTuple, и знает, почему я, кажется, получаю случайные версии его повсюду?
Заранее спасибо!
[EDIT1]
Следуя совету @Lucian, я запустил инструмент Fusion как на своем компьютере разработчика, так и на другом компьютере, где он не работает.
Я заметил, что на моем компьютере DLL-библиотека ValueTuple, обнаруженная в моей корзине, была объявлена версией 4.0.2.0
, а не версией файла.
Поэтому я добавил ...
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="4.0.3.0" newVersion="4.0.2.0" />
</dependentAssembly>
Раньше, на моем компьютере разработчика, если бы я добавил какой-либо из этих bindingRedirect
, я также получил бы ошибку, но теперь, с вышеописанным, это сработало.
Однако, это не было на другом производстве (внутренний тест) машина.С этой машины у меня есть следующий вывод (как только я наконец запустил Fusion на работу) ...
*** Assembly Binder Log Entry (20/11/2018 @ 9:16:49 AM) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.ValueTuple
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System.ValueTuple | Domain ID: 6
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/inetpub/wwwroot/MyApp/
LOG: Initial PrivatePath = C:\inetpub\wwwroot\MyApp\bin
LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\MyApp\0718df87
LOG: Cache Base = C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\MyApp\0718df87
LOG: AppName = ab2266c7
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\inetpub\wwwroot\MyApp\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/MyApp/0718df87/ab2266c7/System.ValueTuple.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/MyApp/0718df87/ab2266c7/System.ValueTuple/System.ValueTuple.DLL.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/MyApp/bin/System.ValueTuple.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\inetpub\wwwroot\MyApp\bin\System.ValueTuple.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
LOG: A partially-specified assembly bind succeeded from the application directory. Need to re-apply policy.
LOG: Using application configuration file: C:\inetpub\wwwroot\MyApp\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 4.0.3.0 redirected to 4.0.2.0.
LOG: Post-policy reference: System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
LOG: GAC Lookup was unsuccessful.
LOG: The post-policy assembly reference requires probing again.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/MyApp/0718df87/ab2266c7/System.ValueTuple.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/MyApp/0718df87/ab2266c7/System.ValueTuple/System.ValueTuple.DLL.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/MyApp/bin/System.ValueTuple.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\inetpub\wwwroot\MyApp\bin\System.ValueTuple.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Setup failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
*** Assembly Binder Log Entry (20/11/2018 @ 9:16:49 AM) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.ValueTuple
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System.ValueTuple | Domain ID: 6
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/inetpub/wwwroot/MyApp/
LOG: Initial PrivatePath = C:\inetpub\wwwroot\MyApp\bin
LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\MyApp\0718df87
LOG: Cache Base = C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\MyApp\0718df87
LOG: AppName = ab2266c7
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\inetpub\wwwroot\MyApp\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/MyApp/0718df87/ab2266c7/System.ValueTuple.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/MyApp/0718df87/ab2266c7/System.ValueTuple/System.ValueTuple.DLL.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/MyApp/bin/System.ValueTuple.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\inetpub\wwwroot\MyApp\bin\System.ValueTuple.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
LOG: A partially-specified assembly bind succeeded from the application directory. Need to re-apply policy.
LOG: Using application configuration file: C:\inetpub\wwwroot\MyApp\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 4.0.3.0 redirected to 4.0.2.0.
LOG: Post-policy reference: System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
LOG: GAC Lookup was unsuccessful.
LOG: The post-policy assembly reference requires probing again.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/MyApp/0718df87/ab2266c7/System.ValueTuple.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/MyApp/0718df87/ab2266c7/System.ValueTuple/System.ValueTuple.DLL.
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/MyApp/bin/System.ValueTuple.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\inetpub\wwwroot\MyApp\bin\System.ValueTuple.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Setup failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Я вижу строку Redirect found in application configuration file: 4.0.3.0 redirected to 4.0.2.0.
, которую он получает от web.config
и 4.0.2.0
это то, что должно быть в папке bin.Это также версия, которая отображается в Dotpeek ..
![](https://i.stack.imgur.com/VzqZB.png)
По какой-то причине кажется, что он пытается получить эту DLL из C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/MyApp
и кажется, что он заканчивается Assembly Name is: System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
, а затем он не выдает отчеты.
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: The assembly reference did not match the assembly definition found.
Если я удаляю это bindingRedirect
, он сообщает о поиске версии 0.0.0.0
.Я понятия не имею, что здесь происходит.Версия, которую мы пытаемся переназначить, т.е. 4.0.2.0
, находится в папке bin!
Я также удалил папку C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\MyApp
, но это не имело никакого значения.
Любые другие идеибудет принята с благодарностью.