dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.24k stars 4.73k forks source link

Fresh clone == build error: `NU1003: PackageTargetFallback and AssetTargetFallback cannot be used together.` #8635

Closed benaadams closed 4 years ago

benaadams commented 7 years ago

error NU1003: PackageTargetFallback and AssetTargetFallback cannot be used together. Remove PackageTargetFallback(deprecated) references from the project environment.

C:\GitHub\coreclr>build.cmd skiptests
Starting Build at 14:07:40.87
BUILD: Commencing CoreCLR Repo build
BUILD: Checking prerequisites
BUILD: Using environment: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\\VsDevCmd.bat"
Installing dotnet cli...
Restoring BuildTools version 2.0.0-prerelease-01812-02...
Initializing BuildTools...
ERROR: An error occured when trying to initialize the tools.
Please check the detailed log that follows.
Running C:\GitHub\coreclr\init-tools.cmd
Installing 'https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.0.0-preview1-005724/dotnet-dev-win-x64.2.0.0-preview1-005724.zip' to 'C:\GitHub\coreclr\Tools\dotnetcli\dotnet-dev-win-x64.2.0.0-preview1-005724.zip'
Running: "C:\GitHub\coreclr\Tools\dotnetcli\dotnet.exe" restore "C:\GitHub\coreclr\init-tools.msbuild" --no-cache --packages C:\GitHub\coreclr\packages\ --source "https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json" /p:BuildToolsPackageVersion=2.0.0-prerelease-01812-02
  Restoring packages for C:\GitHub\coreclr\init-tools.msbuild...
  Installing Microsoft.DotNet.BuildTools 2.0.0-prerelease-01812-02.
  Installing Microsoft.DotNet.BuildTools.CoreCLR 1.0.4-prerelease.
  Generating MSBuild file C:\GitHub\coreclr\Tools/2.0.0-prerelease-01812-02\init-tools.msbuild.nuget.g.props.
  Generating MSBuild file C:\GitHub\coreclr\Tools/2.0.0-prerelease-01812-02\init-tools.msbuild.nuget.g.targets.
  Restore completed in 6.59 sec for C:\GitHub\coreclr\init-tools.msbuild.
Running: "C:\GitHub\coreclr\packages\Microsoft.DotNet.BuildTools\2.0.0-prerelease-01812-02\lib\init-tools.cmd" "C:\GitHub\coreclr\" "C:\GitHub\coreclr\Tools\dotnetcli\dotnet.exe" "C:\GitHub\coreclr\Tools"
"Detected a 2.0-capable CLI."

// ... robocopy spew

C:\GitHub\coreclr>call "C:\GitHub\coreclr\Tools\dotnetcli\dotnet.exe" restore "C:\GitHub\coreclr\packages\microsoft.dotnet.buildtools\2.0.0-prerelease-01812-02\lib\\tool-runtime\project.csproj" --source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json --source https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json --source https://api.nuget.org/v3/index.json
C:\GitHub\coreclr\packages\microsoft.dotnet.buildtools\2.0.0-prerelease-01812-02\lib\tool-runtime\project.csproj : error NU1003: PackageTargetFallback and AssetTargetFallback cannot be used together. Remove PackageTargetFallback(deprecated) references from the project environment.

C:\GitHub\coreclr>set RESTORE_ERROR_LEVEL=1
ERROR: An error occured when running: '"C:\GitHub\coreclr\Tools\dotnetcli\dotnet.exe" restore "C:\GitHub\coreclr\packages\microsoft.dotnet.buildtools\2.0.0-prerelease-01812-02\lib\\tool-runtime\project.csproj"'. Please check above for more details.
BUILD: Error: native component build failed. Refer to the build log files for details:
    "C:\GitHub\coreclr\bin\Logs\CoreCLR_Windows_NT__x64__Debug.log"
    "C:\GitHub\coreclr\bin\Logs\CoreCLR_Windows_NT__x64__Debug.wrn"
    "C:\GitHub\coreclr\bin\Logs\CoreCLR_Windows_NT__x64__Debug.err"

Referenced directory C:\GitHub\coreclr\bin\Logs created but completely empty

benaadams commented 7 years ago

Think is buildtools, have filed issue https://github.com/dotnet/buildtools/issues/1617

benaadams commented 7 years ago

Had to edit coreclr\packages\microsoft.dotnet.buildtools\2.0.0-prerelease-01812-02\lib\tool-runtime\project.csproj to update versions and remove two lines

e.g.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
    <EnableDefaultItems>false</EnableDefaultItems>
    <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">2.0.0-beta-001776-00</RuntimeFrameworkVersion>
    <OutputType>Exe</OutputType>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Program.cs" />
  </ItemGroup>

  <ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
    <PackageReference Include="Microsoft.Build.Framework" Version="15.3.409" />
    <PackageReference Include="Microsoft.Build.Runtime" Version="15.3.409" />
    <PackageReference Include="Microsoft.Build.Tasks.Core" Version="15.3.409" />
    <PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.3.409" />
    <PackageReference Include="Microsoft.Build" Version="15.3.409" />
    <PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="2.0.0" />
    <PackageReference Include="Microsoft.Net.Compilers.netcore" Version="2.0.0-rc4" />
    <PackageReference Include="Microsoft.Net.Compilers.Targets.NetCore" Version="0.1.5-dev" />
    <PackageReference Include="Microsoft.Cci" Version="4.0.0-rc4-24217-00" />
    <PackageReference Include="System.Composition" Version="1.1.0" />
    <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
  </ItemGroup>

  <ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
    <PackageReference Include="Microsoft.Cci" Version="4.0.0-rc4-24217-00" />
    <PackageReference Include="Microsoft.NETCore.Windows.ApiSets" Version="1.0.1" />
    <PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
    <PackageReference Include="System.Diagnostics.FileVersionInfo" Version="4.3.0" />
    <PackageReference Include="System.Diagnostics.TraceSource" Version="4.3.0" />
  </ItemGroup>

</Project>
rrelyea commented 7 years ago

Link to help content for NU1003: https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings#nu1003