Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet build doesn't compile with 2.0.0-preview2-final for MVC template #8426

Closed
vRITHNER opened this issue Jun 20, 2017 · 18 comments
Closed

Comments

@vRITHNER
Copy link

Steps to reproduce

Add new project from VS (mvc --auth Individual):

  • Build
  • Build 100%

Do the same from shell command:

  • dotnet new mvc --auth Individual
  • dotnet build

Expected behavior

build

Actual behavior

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

Environment data

    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0-preview2-final" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0-preview2-final" PrivateAssets="All" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0-preview2-final" PrivateAssets="All" />

dotnet --info output:

 Version:            2.0.0-preview2-006470
 Commit SHA-1 hash:  4ea3671bbd

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16215
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.0-preview2-006470\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0-preview2-25407-01
  Build    : 40c565230930ead58a50719c0ec799df77bddee9

@livarcocc
Copy link
Contributor

This has been fixed in the latest preview2 build.

@vRITHNER
Copy link
Author

Looks like it's not the same story between VS latest and dotNet/CLI latest (2.0.0-preview2-006497);

from CLI:
dotnet new mvc --auth Individual -uld

The template "ASP.NET Core Web App (Model-View-Controller)" was created successfully.
This template contains technologies from parties other than Microsoft, see https://aka.ms/template-3pn for details.

Processing post-creation actions...
Running 'dotnet restore' on D:\Temp\IdTest7\IdTest7.csproj...
Restoring packages for D:\Temp\IdTest7\IdTest7.csproj...
Restore completed in 42.09 ms for D:\Temp\IdTest7\IdTest7.csproj.
Restore completed in 42.21 ms for D:\Temp\IdTest7\IdTest7.csproj.
Restore completed in 49.63 ms for D:\Temp\IdTest7\IdTest7.csproj.
D:\Temp\IdTest7\IdTest7.csproj : warning NU1701: Package 'Microsoft.Composition 1.0.27' was restored using '.NETPortable,Version=v0.0,Profile=Profile259, .NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
D:\Temp\IdTest7\IdTest7.csproj : warning NU1701: Package 'SQLitePCLRaw.lib.e_sqlite3.linux 1.1.5' was restored using '.NETPortable,Version=v0.0,Profile=Profile259, .NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
D:\Temp\IdTest7\IdTest7.csproj : warning NU1701: Package 'SQLitePCLRaw.lib.e_sqlite3.osx 1.1.5' was restored using '.NETPortable,Version=v0.0,Profile=Profile259, .NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
D:\Temp\IdTest7\IdTest7.csproj : warning NU1701: Package 'SQLitePCLRaw.lib.e_sqlite3.v110_xp 1.1.5' was restored using '.NETPortable,Version=v0.0,Profile=Profile259, .NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
Generating MSBuild file D:\Temp\IdTest7\obj\IdTest7.csproj.nuget.g.props.
Generating MSBuild file D:\Temp\IdTest7\obj\IdTest7.csproj.nuget.g.targets.
Restore completed in 2.69 sec for D:\Temp\IdTest7\IdTest7.csproj.

At least the build is successful.

From VS (latest 15.3.0 Preview 2.1), new project to create the same type of project:
I can't compile it

2017-06-21_17h01_12

txs
-Vince

@vRITHNER
Copy link
Author

if I change back the line in Csproj

<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

to

<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>

VS compile but not DotNet cli

@andrewlock
Copy link

I can reproduce this too, when running dotnet new mvc --auth Individual -uld

@Tealons
Copy link

Tealons commented Jun 30, 2017

I have the same problem with 2.0.0-preview2-006497.

@livarcocc : Can you reopen this issue? Is seems to be back...

@livarcocc
Copy link
Contributor

@mlorbetske @balachir can you guys take a look at this?

@mlorbetske
Copy link
Contributor

I think this is because the change to support AssetTargetFallback came in 15.3 Preview 3, so updating VS to the very latest preview again should work.

@andrewlock
Copy link

I'm only compiling via the command line (I haven't installed VS) and I see the restore warnings, namely

warning NU1701: Package 'Microsoft.Composition 1.0.27' was restored using '.NETPortable,Version=v0.0,Profile=Profile259, .NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.

I assume dotnet build doesn't have a dependency on the VS version?

@WestDiscGolf
Copy link

I'm getting a very similar error ...

Warning NU1701 Package 'Microsoft.Composition 1.0.27' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems. BackEnd

And I'm trying to run through @jongalloway conference workshop examples from - https://github.com/jongalloway/aspnetcore-app-workshop/blob/master/docs/2.%20Build%20out%20BackEnd%20and%20Refactor.md - and I'm up to "Add a new database migration" and it won't build.

I've tried updating the package references:

   <ItemGroup>
     <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0-preview2-final" />
     <PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0-preview2-final" />
     <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0-preview2-final" />
     <PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
   </ItemGroup>

and the cli tools references ...

 <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0-preview2-final" />
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0-preview2-final" />
  </ItemGroup>

Have I missed something?

Running dotnet run or dotnet restore on the command line I get ...

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

@livarcocc
Copy link
Contributor

@WestDiscGolf we have updated the SDK to have an implicit AssetTargetFallback to net461. Your project probably has a PackageTargetFallback property and the two are mutually excluding, like the error message suggests.

So, you can either update your project and replace PackageTargetFallback with AssetTargetFallback, or you can disable the implicit ATF by setting DisableImplicitAssetTargetFallback to true in your project.

@WestDiscGolf
Copy link

@livarcocc Thanks for the speedy response. On replacing PackageTargetFallback with AssetTargetFallback I get, in yellow in powershell, the following:

PS C:\Users\Adam\Documents\Visual Studio 2017\Projects\Workshop\BackEnd> dotnet run
C:\Users\Adam\Documents\Visual Studio 2017\Projects\Workshop\BackEnd\BackEnd.csproj : warning NU1701: Package 'Microsoft.Composition 1.0.27' was restored using '.NETPortable,Version=v0.0,Profile=Profile7, .NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.
C:\Users\Adam\Documents\Visual Studio 2017\Projects\Workshop\BackEnd\BackEnd.csproj : warning NU1701: Package 'Microsoft.Composition 1.0.27' was restored using '.NETPortable,Version=v0.0,Profile=Profile7, .NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.

Adding in the DIATF node in the csproj file it fails with:

error NU1202: Package Microsoft.Composition 1.0.27 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package Microsoft.Composition 1.0.27 supports: portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)

The build failed. Please fix the build errors and run again.

Is that right? Should there still be a warning?

This is all new to me so apologies if these are stupid questions / issues.

@livarcocc
Copy link
Contributor

The warning is expected, though in the latest versions of asp.net I believe we have moved to no longer depend on that package. So, in newer versions, the warning should not appear.

@WestDiscGolf
Copy link

@livarcocc Cool, thanks for letting me know!

@benaadams
Copy link
Member

This causing the issue I'm seeing when trying to build coreclr (also corefx)? https://github.com/dotnet/coreclr/issues/13025

@livarcocc
Copy link
Contributor

@benaadams You need to choose either ATF or PTF. I explained it above.

@benaadams
Copy link
Member

@livarcocc not entirely sure what .\build does when compiling coreclr/corefx; its a wild ride, will see if I can work out what needs changing

@benaadams
Copy link
Member

Think its the buildtools have filed issue dotnet/buildtools#1617

@rrelyea
Copy link
Contributor

rrelyea commented Sep 25, 2017

Helping search engines find the right content: https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings#nu1003

@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants