如何解决 NuGet.targets(124,5): 错误:值不能 > null。 (参数“文件夹名称”)错误?

2023-12-23

在构建项目时我收到此错误。

错误 NETSDK1004 资产文件 未找到“J:\Test\core\fx-core\obj\project.assets.json”。运行 NuGet 包恢复生成此文件。 FxCore C:\程序 文件\dotnet\sdk\3.1.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 234

所以为了解决这个问题我正在运行命令dotnet restore在包管理器控制台中。但在运行时我收到以下错误。

PM> dotnet 恢复 J:\Test\core\fx-core\FxCore.csproj(3,3):警告 MSB4011:“C:\程序 Files\dotnet\sdk\3.1.201\Current\Microsoft.Common.props”不能是 再次导入。它已经导入到“C:\Program 文件\dotnet\sdk\3.1.201\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.props (40,3)”。 这很可能是构建创作错误。此后导入 将被忽略。 C:\程序 文件\ dotnet \ sdk \ 3.1.201 \ Sdks \ Microsoft.NET.Sdk \ Sdk \ Sdk.targets(37,3): 警告 MSB4011:“C:\Program 文件\dotnet\sdk\3.1.201\Microsoft.CSharp.targets”无法导入 再次。它已经导入到“J:\Test\core\fx-core\FxCore.csproj (118,3)"。这很可能是构建创作错误。随后的 导入将被忽略。 C:\程序 Files\dotnet\sdk\3.1.201\NuGet.targets(124,5):错误:值不能为 无效的。 (参数'文件夹名称') [J:\Test\core\fx-core\FxCore.sln] PM>

如何解决这个问题?

.Net目标框架:4.6.1

视觉工作室:2019 (16.5.2)

项目类型:类库

Update:

根据@Lennart请求添加csproj文件

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Sdk="Microsoft.NET.Sdk">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{459BF9F7-69C7-4BBD-B566-CEFB992F88D5}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>FX.Core</RootNamespace>
    <AssemblyName>FxCore</AssemblyName>
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <TargetFrameworkProfile />
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <Version>1.0.2.9</Version>
    <Company>INTL FCStone</Company>
    <Authors>INTL FCStone</Authors>
    <Description>FxCore Assembly</Description>
    <Copyright>Copyright 2018</Copyright>
    <PackageReleaseNotes>version 1.0.2</PackageReleaseNotes>
    <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>TRACE;DEBUG</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Compile Remove="packages\**" />
    <Compile Remove="_CreateNewNuGetPackage\**" />
    <EmbeddedResource Remove="packages\**" />
    <EmbeddedResource Remove="_CreateNewNuGetPackage\**" />
    <None Remove="packages\**" />
    <None Remove="_CreateNewNuGetPackage\**" />
  </ItemGroup>
  <ItemGroup>
    <Reference Include="Dapper, Version=1.50.2.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>packages\Dapper.1.50.2\lib\net45\Dapper.dll</HintPath>
    </Reference>
    <Reference Include="EasyNetQ, Version=0.63.6.463, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>packages\EasyNetQ.0.63.6.463\lib\net45\EasyNetQ.dll</HintPath>
    </Reference>
    <Reference Include="FXEntity, Version=1.0.1.12, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>packages\FXEntity.1.0.2.12\lib\net45\FXEntity.dll</HintPath>
    </Reference>
    <Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
      <HintPath>packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <HintPath>packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Practices.Unity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f, processorArchitecture=MSIL">
      <HintPath>packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Practices.Unity.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f, processorArchitecture=MSIL">
      <HintPath>packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.Configuration.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Practices.Unity.RegistrationByConvention, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f, processorArchitecture=MSIL">
      <HintPath>packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.RegistrationByConvention.dll</HintPath>
    </Reference>
    <Reference Include="Ninject, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
      <HintPath>packages\Ninject.3.2.2.0\lib\net45-full\Ninject.dll</HintPath>
    </Reference>
    <Reference Include="RabbitMQ.Client, Version=3.6.6.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce, processorArchitecture=MSIL">
      <HintPath>packages\RabbitMQ.Client.3.6.6\lib\net45\RabbitMQ.Client.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.configuration" />
    <Reference Include="System.Core" />
    <Reference Include="System.Web" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Properties\" />
    <Compile Remove="Configuration\UspHostLoginValidateResult.cs" />
    <Compile Remove="Configuration\UspHostUserRoleMenuListResult.cs" />
    <Compile Remove="Properties\AssemblyInfo.cs" />
    <Folder Include="DataAccess\" />
    <Folder Include="DataAccess\Components" />
    <Folder Include="Diagnostics\" />
    <Folder Include="Diagnostics\Components" />
    <Folder Include="NetworkProtocols\" />
    <Folder Include="Unity\" />   
  </ItemGroup>
  <ItemGroup>
    <None Include="app.config">
      <SubType>Designer</SubType>
    </None>
    <None Include="packages.config" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Connect.SSO" Version="3.5.6.1" />
    <PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.6" />
    <PackageReference Include="Dapper" Version="1.50.2.0" />
    <PackageReference Include="EasyNetQ" Version="0.63.6.463" />
    <PackageReference Include="log4net" Version="2.0.8.0" />
    <PackageReference Include="Microsoft.Practices.ServiceLocation" Version="1.3.0.0" />
    <PackageReference Include="Ninject" Version="3.2.0.0" />
    <PackageReference Include="RabbitMQ.Client" Version="3.6.6.0" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!--<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
    <Exec Command="&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;" />
  </Target>-->
</Project>

在 csproj 中,出现了一些内容:

  • 有两个<Import>看起来不必要的 - 删除/评论它们
  • 没有目标框架 - 尝试<TargetFramework>net461</TargetFramework>或第一个类似的<PropertyGroup>
  • 根元素过于复杂;可以只是<Project Sdk="Microsoft.NET.Sdk">
  • you don't need <Reference> elements for things that also have <PackageReference> - you can probably remove the <Reference> for things like "Dapper" and "Ninject"
    • 这将是优选如果可能的话,专门使用包引用

但是:通过这些更改,它应该可以工作。我的猜测是,这是一个预 SDK 项目文件,已被手动破解并调整为接近工作 SDK 项目文件的文件。


<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
  <TargetFramework>net461</TargetFramework>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{459BF9F7-69C7-4BBD-B566-CEFB992F88D5}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>FX.Core</RootNamespace>
    <AssemblyName>FxCore</AssemblyName>
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <TargetFrameworkProfile />
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <Version>1.0.2.9</Version>
    <Company>INTL FCStone</Company>
    <Authors>INTL FCStone</Authors>
    <Description>FxCore Assembly</Description>
    <Copyright>Copyright 2018</Copyright>
    <PackageReleaseNotes>version 1.0.2</PackageReleaseNotes>
    <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>TRACE;DEBUG</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Compile Remove="packages\**" />
    <Compile Remove="_CreateNewNuGetPackage\**" />
    <EmbeddedResource Remove="packages\**" />
    <EmbeddedResource Remove="_CreateNewNuGetPackage\**" />
    <None Remove="packages\**" />
    <None Remove="_CreateNewNuGetPackage\**" />
  </ItemGroup>
  <ItemGroup>
    <Reference Include="FXEntity, Version=1.0.1.12, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>packages\FXEntity.1.0.2.12\lib\net45\FXEntity.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Practices.Unity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f, processorArchitecture=MSIL">
      <HintPath>packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Practices.Unity.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f, processorArchitecture=MSIL">
      <HintPath>packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.Configuration.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Practices.Unity.RegistrationByConvention, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f, processorArchitecture=MSIL">
      <HintPath>packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.RegistrationByConvention.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.configuration" />
    <Reference Include="System.Core" />
    <Reference Include="System.Web" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Properties\" />
    <Compile Remove="Configuration\UspHostLoginValidateResult.cs" />
    <Compile Remove="Configuration\UspHostUserRoleMenuListResult.cs" />
    <Compile Remove="Properties\AssemblyInfo.cs" />
    <Folder Include="DataAccess\" />
    <Folder Include="DataAccess\Components" />
    <Folder Include="Diagnostics\" />
    <Folder Include="Diagnostics\Components" />
    <Folder Include="NetworkProtocols\" />
    <Folder Include="Unity\" />   
  </ItemGroup>
  <ItemGroup>
    <None Include="app.config">
      <SubType>Designer</SubType>
    </None>
    <None Include="packages.config" />
  </ItemGroup> 
  <ItemGroup>
    <PackageReference Include="Connect.SSO" Version="3.5.6.1" />
    <PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.6" />
    <PackageReference Include="Dapper" Version="1.50.2.0" />
    <PackageReference Include="EasyNetQ" Version="0.63.6.463" />
    <PackageReference Include="log4net" Version="2.0.8.0" />
    <PackageReference Include="Microsoft.Practices.ServiceLocation" Version="1.3.0.0" />
    <PackageReference Include="Ninject" Version="3.2.0.0" />
    <PackageReference Include="RabbitMQ.Client" Version="3.6.6.0" />
  </ItemGroup>
</Project>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何解决 NuGet.targets(124,5): 错误:值不能 > null。 (参数“文件夹名称”)错误? 的相关文章

随机推荐

  • 如何使用 mongoexport 导出排序数据?

    我在 mongo 中有一个集合 其中包含名称和计数字段 name myName count 5 是否可以使用 mongoexport 按计数对数据进行排序并导出为 json 从 MongoDB 2 6 开始 您可以通过 sort to mo
  • 使用 标签代替 图标有哪些优点/缺点?

    Facebook 的 HTML 和 Twitter Bootstrap HTML v3 之前 都使用 i 标签来显示图标 然而 从HTML5 规范 http www w3 org International questions qa b a
  • 使用 F# 中的 Applicative 功能构建记录

    假设有一个type r A int B string C int D string 和一些值 let aOptional int option let bOptional string option let cOptional int op
  • 相当于张量流中的 numpy.digitize

    我正在研究一个使用的自定义损失函数numpy digitize 内部 对于一组参数 损失最小化bins数字化方法中使用的值 为了使用tensorflow优化器 我想知道是否有等效的实现digitize in tensorflow 如果没有
  • Google 图表背景颜色不适用于示例代码

    我使用的代码来自示例页面 https developers google com chart interactive docs gallery barchart创建水平条形图 选项backgroundColor适用于其他图表类型 例如thi
  • MooTools 的 Function.prototype.overloadSetter() 是做什么的?

    我正在浏览 MooTools 源代码来尝试理解它 implement and extend 公用事业 每个的定义指的是这样定义的函数 var enumerables true for var i in toString 1 enumerab
  • 禁用 RStudio 中的所有断点

    有没有办法禁用 RStudio 中的所有断点 我查看了 RStudio 文档并进行了谷歌搜索 但找不到方法 我也很好奇 特别想了解断点的概述 I ran grep在我的项目文件夹中 这是我发现的 首先 打开 RStudio 后 断点不会显示
  • swift 中的 T.Type 是什么

    谁能告诉我什么是T Type当我使用JSONDecoder decode 我认为它是解码我编码的数据的类型 很多例子都使用上面的方法 如下所示 JSONEncoder decode People self from data 如果我检查该方
  • 插件“react”中的错误与之间发生冲突

    我在我的主 React 应用程序中使用另一个 React 存储库 我们称之为设计 作为 git 子模块 我使用 webpack 来构建主应用程序 将子模块集成到应用程序中后 我在 webpack 构建过程中收到以下错误 ERROR in P
  • 如何使用 widgets.SelectMultiple() 交互地选择要绘制的系列?

    背景 类似的问题已被问到here https stackoverflow com questions 12891860 interactive selection of series in a matplotlib plot 但不是很具体
  • Angular 6 库共享样式表

    如何设置 index scss 并将变量 混合等的全局样式表导入到 Angular 6 库中 Angular CLI 生成一个带有根组件和组件 scss 的 lib 但添加或导入到根组件的样式不可用于子组件 默认情况下 封装样式是有意义的
  • 在 SQL Server Management Studio 中将持久计算列标记为 NOT NULL

    在 SQL Server 2005 中可以创建一个既持久又定义为 NOT NULL 不能包含空值 的计算列 当使用像 Linq2Sql 这样的库时 如果我们想避免大量的手动工作来确保我们的代码列 始终 具有值 那么第二个属性非常重要 使用直
  • Android 1.5 Gradle Sync 从未完成

    我最近升级到 Android Studio 1 5 然而 更新后 Gradle 陷入 正在刷新 项目 Gradle 项目 并且永远不会停止 以前版本的 Android Studio 运行得很好 我该如何解决这个问题 我使用的是 Ubuntu
  • 在轴上手动定位刻度 - D3

    我正在使用 d3 制作图表 我想将刻度线放在 xAxis 上我指定的位置 例如 如果我想要以下位置的刻度线 11 0 11 18 30 42 我该怎么做 Thanks 请参阅文档 axis tickValues https github c
  • 如何限制仅从 NLB 对 EC2 的访问

    Question 有没有办法确保访问仅来自特定的 NLB 在目前NLB的限制下 不知道有没有办法 局限性 AWS Network Load Balancer NLB 没有安全组 SG 因此无法使用 SG 来验证源是否为 NLB NLB 实例
  • 计算某个点与英国海岸之间的最小距离

    我一直在遵循所示的示例here https stackoverflow com questions 21295302 calculating minimum distance between a point and the coast 但对
  • 永久修改App.config C#

    好的 所以我正在尝试使用appSettings中的元素App Config文件来确定使用哪种存储 这是我的应用程序配置 file
  • Google 一键登录 (YOLO) + Firebase 身份验证?

    我注意到 Google 已重新开放Google 一键登录和自动注册 https developers google com identity one tap web由于安全问题而暂停后 我一直在尝试了解如何使其与 Firebase Auth
  • 如何在unix中使用mv命令重命名多个文件?

    我正在尝试用扩展名重命名多个文件xyz n 到扩展xyz 例子 mv xyz 1 to xyz 但错误是这样的 xyz No such file or directory 不知道 mv 是否可以直接使用 工作 但这可以工作 find nam
  • 如何解决 NuGet.targets(124,5): 错误:值不能 > null。 (参数“文件夹名称”)错误?

    在构建项目时我收到此错误 错误 NETSDK1004 资产文件 未找到 J Test core fx core obj project assets json 运行 NuGet 包恢复生成此文件 FxCore C 程序 文件 dotnet