重新映射汇编

huangapple go评论112阅读模式
英文:

Remapping Assembly

问题

我的应用最初是使用VS2012开发的。几年后,该安装程序损坏了,我不得不安装VB2019。在这个新版本中,我不得不添加NuGet包“Microsoft.ReportingServices.ReportViewerControl.Winforms”,并使用其新的报表查看器控件来正确显示此应用程序使用的.rdlc报表。

自从转换后,我现在在每次构建后都会收到三个程序集的以下警告:“Microsoft SQL Server Types”,“EnvDTE”和“Microsoft.VisualStudio.GraphModel”:

考虑在app.config中重新映射程序集[AssemblyName,Culture,PublicKeyToken]的版本[OldVersionNo]到版本[NewVersionNo],然后它会给出该程序集所在的文件夹。

我的应用程序中的app.config文件包含最少的信息,并且不包括对这三个程序集的任何提及。那么,我该如何修复这些警告?如果需要,我可以提供我的app.config文件的内容。

以下是我收到的完整错误消息:

考虑将程序集“Microsoft.SqlServer.Types,Culture=neutral,PublicKeyToken=89845dcd8080cc91”的版本从“12.0.0.0” [C:\WINDOWS\assembly\GAC_MSIL\Microsoft.SqlServer.Types\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Types.dll] 重新映射到版本“14.0.0.0” [C:\DATA\StinsonSolutions\AppelateInnovations\packages\Microsoft.SqlServer.Types.14.0.314.76\lib\net40\Microsoft.SqlServer.Types.dll] 以解决冲突并消除警告。

考虑将程序集“EnvDTE,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”的版本从“7.0.3300.0” [] 重新映射到版本“8.0.0.0” [C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies\EnvDTE.dll] 以解决冲突并消除警告。

考虑将程序集“Microsoft.VisualStudio.GraphModel,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”的版本从“11.0.0.0” [] 重新映射到版本“14.0.0.0” [C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.GraphModel.dll] 以解决冲突并消除警告。

Larry

英文:

My app was originally developed with VS2012. After some years, that installation became corrupted and I had to install VB2019. With this new version, I had to add the NuGet package “Microsoft.ReportingServices.ReportViewerControl.Winforms” and use its new report viewer control to properly display the .rdlc reports used by this app.

Since the conversion, I now get the following warnings for three assemblies, "Microsoft SQL Server Types", "EnvDTE" and "Microsoft.VisualStudio.GraphModel" after each build:

Consider app.config remapping of assembly [AssemblyName, Culture, PublicKeyToken] from version [OldVersionNo] to version [NewVersionNo] after which it gives me the folder where that assembly is located.

The app.config file in my app contains minimal information and does not include any mention of these three assemblies. So how do I fix these warnings? I'm happy to provide the contents of my app.config file if needed.

Here is the full error message I am getting:

Consider app.config remapping of assembly "Microsoft.SqlServer.Types, Culture=neutral, PublicKeyToken=89845dcd8080cc91" from Version "12.0.0.0" [C:\WINDOWS\assembly\GAC_MSIL\Microsoft.SqlServer.Types\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Types.dll] to Version "14.0.0.0" [C:\DATA\StinsonSolutions\AppelateInnovations\packages\Microsoft.SqlServer.Types.14.0.314.76\lib\net40\Microsoft.SqlServer.Types.dll] to solve conflict and get rid of warning.

Consider app.config remapping of assembly "EnvDTE, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "7.0.3300.0" [] to Version "8.0.0.0" [C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies\EnvDTE.dll] to solve conflict and get rid of warning.

Consider app.config remapping of assembly "Microsoft.VisualStudio.GraphModel, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "11.0.0.0" [] to Version "14.0.0.0" [C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.GraphModel.dll] to solve conflict and get rid of warning.

Larry

答案1

得分: 0

我相信你需要在你的app.config文件中添加一些重定向程序集版本的指令。

从网站上可以找到如下信息:

手动编辑应用程序配置文件:您可以手动编辑应用程序配置文件以解决程序集问题。例如,如果供应商发布了您的应用程序使用的程序集的新版本,但没有提供发布者策略,因为他们不保证向后兼容性,您可以通过将程序集绑定信息放入您的应用程序的配置文件中来指示您的应用程序使用新版本的程序集,如下所示。

<dependentAssembly>
   <assemblyIdentity name="someAssembly" publicKeyToken="32ab4ba45e0a69a1" culture="en-us" />  
   <bindingRedirect oldVersion="7.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>

因此,对于你的情况,这将是(下面显示了完整的Xml层次结构):

<config>
<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" culture="neutral" />  
      <bindingRedirect oldVersion="0.0.0.0-14.0.0.0" newVersion="14.0.0.0" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="EnvDTE" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />  
      <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.VisualStudio.GraphModel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />  
      <bindingRedirect oldVersion="0.0.0.0-14.0.0.0" newVersion="14.0.0.0" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>
</config>

如果你的app.config文件中还有其他部分,那么你只需要在文件的末尾添加<assemblyBinding>部分。


如果您提供完整的错误消息,我将很乐意提供详细信息。

英文:

I believe you have to add some Redirecting assembly versions instructions to your app.config file.

From the website:

> Manually edit the app config file: You can manually edit the app configuration file to resolve assembly issues. For example, if a
> vendor might release a newer version of an assembly that your app uses
> without supplying a publisher policy, because they do not guarantee
> backward compatibility, you can direct your app to use the newer
> version of the assembly by putting assembly binding information in
> your app's configuration file as follows.
>

&lt;dependentAssembly&gt;
   &lt;assemblyIdentity name=&quot;someAssembly&quot; publicKeyToken=&quot;32ab4ba45e0a69a1&quot; culture=&quot;en-us&quot; /&gt;  
   &lt;bindingRedirect oldVersion=&quot;7.0.0.0&quot; newVersion=&quot;8.0.0.0&quot; /&gt;
&lt;/dependentAssembly&gt;

So, for you, this would be (I have shown the full Xml hierarchy below) :

&lt;config&gt;
&lt;runtime&gt;
  &lt;assemblyBinding xmlns=&quot;urn:schemas-microsoft-com:asm.v1&quot;&gt;
    &lt;dependentAssembly&gt;
      &lt;assemblyIdentity name=&quot;Microsoft.SqlServer.Types&quot; publicKeyToken=&quot;89845dcd8080cc91&quot; culture=&quot;neutral&quot; /&gt;  
      &lt;bindingRedirect oldVersion=&quot;0.0.0.0-14.0.0.0&quot; newVersion=&quot;14.0.0.0&quot; /&gt;
    &lt;/dependentAssembly&gt;
    &lt;dependentAssembly&gt;
      &lt;assemblyIdentity name=&quot;EnvDTE&quot; publicKeyToken=&quot;b03f5f7f11d50a3a&quot; culture=&quot;neutral&quot; /&gt;  
      &lt;bindingRedirect oldVersion=&quot;0.0.0.0-8.0.0.0&quot; newVersion=&quot;8.0.0.0&quot; /&gt;
    &lt;/dependentAssembly&gt;
    &lt;dependentAssembly&gt;
      &lt;assemblyIdentity name=&quot;Microsoft.VisualStudio.GraphModel&quot; publicKeyToken=&quot;b03f5f7f11d50a3a&quot; culture=&quot;neutral&quot; /&gt;  
      &lt;bindingRedirect oldVersion=&quot;0.0.0.0-14.0.0.0&quot; newVersion=&quot;14.0.0.0&quot; /&gt;
    &lt;/dependentAssembly&gt;
  &lt;/assemblyBinding&gt;
&lt;/runtime&gt;
&lt;/config&gt;

If you have other sections in your app.config file, then you just need to add the &lt;assemblyBinding&gt; section at the end of your file.

<strike>
If you add the full error message, I would be happy to update the answer with full information.
</strike>

huangapple
  • 本文由 发表于 2023年7月12日 23:09:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/76672070.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定