C# Ho到reference.NETPortable,版本=v4.6,配置文件=Profile44

C# Ho到reference.NETPortable,版本=v4.6,配置文件=Profile44,c#,visual-studio,build,portable-class-library,C#,Visual Studio,Build,Portable Class Library,编辑:因为使用提供的答案无法解决问题。我接受了切换到.NetStandard的建议,这就是答案被接受的原因 我得到了这个错误,但我无法解决它: 您的项目未引用“.NETPortable,Version=v4.6,Profile=Profile44”框架。在项目文件的“TargetFrameworks”属性中添加对“.NETPortable,Version=v4.6,Profile=Profile44”的引用,然后重新运行NuGet restore。 My.csproj看起来像这样: <?x

编辑:因为使用提供的答案无法解决问题。我接受了切换到.NetStandard的建议,这就是答案被接受的原因

我得到了这个错误,但我无法解决它:

您的项目未引用“.NETPortable,Version=v4.6,Profile=Profile44”框架。在项目文件的“TargetFrameworks”属性中添加对“.NETPortable,Version=v4.6,Profile=Profile44”的引用,然后重新运行NuGet restore。

My.csproj看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{1D5637E9-E724-4943-A535-5B61D0C1C4BC}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>xxx.xxx.xxx/RootNamespace>
    <AssemblyName>xxx.xxx.xxx</AssemblyName>
    <DefaultLanguage>en-US</DefaultLanguage>
    <FileAlignment>512</FileAlignment>
    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <TargetFrameworkProfile>Profile44</TargetFrameworkProfile>
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
    <SccProjectName>SAK</SccProjectName>
    <SccLocalPath>SAK</SccLocalPath>
    <SccAuxPath>SAK</SccAuxPath>
    <SccProvider>SAK</SccProvider>
  </PropertyGroup>

10
调试
任意CPU
{1D5637E9-E724-4943-A535-5B61D0C1C4BC}
图书馆

我不知道我能改变什么来解决这个问题

提前谢谢。

你收到了吗? 如果没有,请安装它并确保内容放在正确的文件夹中,例如
C:\ProgramFiles(x86)\Reference Assembly\Microsoft\Framework


但是,由于这一点已被否决,建议使用.NETStandard代替,请参阅以获取介绍。

您是否尝试通过右键单击项目下的引用来添加引用,然后
添加引用…
?我不知道要添加哪一个。即使在我下载的程序集中,也没有使用此名称的dll。我现在下载了它?我恢复了,但什么也没发生,所以我要卸载它们还是什么我考虑改变类型,但首先我需要让我的项目运行,因为已经实现了库。你可以试着先添加一个新的便携式类库吗?通常,您的csproj在底部会有一个导入标记,例如:该标记存在于新项目和旧项目中。我使用VS对它们进行了比较。没有区别,这可能是问题所在。我不能提供项目,因为公司的安全指南。我的同事已经将类库实现为.NetStandardI。很抱歉,我无法提供所需的类库,所以这个问题将一直没有答案,但我非常感谢您的努力。非常感谢。
    <TargetFrameworkProfile>Profile44</TargetFrameworkProfile>
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>