zoukankan      html  css  js  c++  java
  • 未能加载文件或程序集“System.ValueTuple, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。

    一些老的项目在使用SAEA.Socket相关库后,程序本地测试正常,结果上传到服务器上后提示:未能加载文件或程序集“System.ValueTuple, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040),其实这个和是不是引用或缺少了System.ValueTuple无任何关系,主要原因就是项目比较老,下面仔细看看项目修改前的xml

     1 <?xml version="1.0" encoding="utf-8"?>
     2 <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     3   <PropertyGroup>
     4     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     5     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
     6     <ProjectGuid>{78CE982E-88D7-4959-AB4E-69DDDC183B1B}</ProjectGuid>
     7     <OutputType>Exe</OutputType>
     8     <AppDesignerFolder>Properties</AppDesignerFolder>
     9     <RootNamespace>test</RootNamespace>
    10     <AssemblyName>test</AssemblyName>
    11     <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
    12     <FileAlignment>512</FileAlignment>
    13     <TargetFrameworkProfile />
    14     <PublishUrl>publish</PublishUrl>
    15     <Install>true</Install>
    16     <InstallFrom>Disk</InstallFrom>
    17     <UpdateEnabled>false</UpdateEnabled>
    18     <UpdateMode>Foreground</UpdateMode>
    19     <UpdateInterval>7</UpdateInterval>
    20     <UpdateIntervalUnits>Days</UpdateIntervalUnits>
    21     <UpdatePeriodically>false</UpdatePeriodically>
    22     <UpdateRequired>false</UpdateRequired>
    23     <MapFileExtensions>true</MapFileExtensions>
    24     <ApplicationRevision>0</ApplicationRevision>
    25     <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
    26     <IsWebBootstrapper>false</IsWebBootstrapper>
    27     <UseApplicationTrust>false</UseApplicationTrust>
    28     <BootstrapperEnabled>true</BootstrapperEnabled>
    29   </PropertyGroup>
    30   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    31     <PlatformTarget>x64</PlatformTarget>
    32     <DebugSymbols>true</DebugSymbols>
    33     <DebugType>full</DebugType>
    34     <Optimize>false</Optimize>
    35     <OutputPath>binDebug</OutputPath>
    36     <DefineConstants>DEBUG;TRACE</DefineConstants>
    37     <ErrorReport>prompt</ErrorReport>
    38     <WarningLevel>4</WarningLevel>
    39     <Prefer32Bit>false</Prefer32Bit>
    40     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    41   </PropertyGroup>
    42   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    43     <PlatformTarget>x64</PlatformTarget>
    44     <DebugType>pdbonly</DebugType>
    45     <Optimize>true</Optimize>
    46     <OutputPath>binRelease</OutputPath>
    47     <DefineConstants>TRACE</DefineConstants>
    48     <ErrorReport>prompt</ErrorReport>
    49     <WarningLevel>4</WarningLevel>
    50     <Prefer32Bit>false</Prefer32Bit>
    51     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    52   </PropertyGroup>

    这个项目是vs2015创建的,虽然现在用vs2017或者vs2019打开可以本地运行,但是只要放服务器上就会报未能加载文件或程序集“System.ValueTuple, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。所以直接将项目改成vs2017建的格式再看看,xml如下:

     1 <?xml version="1.0" encoding="utf-8"?>
     2 <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     3   <PropertyGroup>
     4     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     5     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
     6     <ProjectGuid>{78CE982E-88D7-4959-AB4E-69DDDC183B1B}</ProjectGuid>
     7     <OutputType>Exe</OutputType>
     8     <RootNamespace>test</RootNamespace>
     9     <AssemblyName>test</AssemblyName>
    10     <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
    11     <FileAlignment>512</FileAlignment>
    12     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    13     <Deterministic>true</Deterministic>
    14   </PropertyGroup>
    15   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    16     <PlatformTarget>AnyCPU</PlatformTarget>
    17     <DebugSymbols>true</DebugSymbols>
    18     <DebugType>full</DebugType>
    19     <Optimize>false</Optimize>
    20     <OutputPath>binDebug</OutputPath>
    21     <DefineConstants>DEBUG;TRACE</DefineConstants>
    22     <ErrorReport>prompt</ErrorReport>
    23     <WarningLevel>4</WarningLevel>
    24   </PropertyGroup>
    25   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    26     <PlatformTarget>x64</PlatformTarget>
    27     <DebugType>pdbonly</DebugType>
    28     <Optimize>true</Optimize>
    29     <OutputPath>binRelease</OutputPath>
    30     <DefineConstants>TRACE</DefineConstants>
    31     <ErrorReport>prompt</ErrorReport>
    32     <WarningLevel>4</WarningLevel>
    33     <Prefer32Bit>false</Prefer32Bit>
    34   </PropertyGroup>

    对比差别:

     将左侧的改为右侧的配置,上述异常消失!

  • 相关阅读:
    电感(29)之铁氧体磁珠工作原理透彻详解
    电阻(7)之零欧姆电阻
    高速数字逻辑电平(8)之LVDS差分信号深度详解
    每天进步一点点------Error: Can't place pins assigned to pin location Pin_K22 (IOPAD_X41_Y19_N14)
    每天进步一点点------入门视频采集与处理(视频分辨率介绍)
    每天进步一点点------入门视频采集与处理(显示YUV数据)
    每天进步一点点------YUV格式详细解释
    每天进步一点点------入门视频采集与处理(BT656简介)
    每天进步一点点------FPGA 静态时序分析模型——reg2reg
    每天进步一点点------SysTimer
  • 原文地址:https://www.cnblogs.com/yswenli/p/14475622.html
Copyright © 2011-2022 走看看