Migration from 2.2 to 3.1.
Project Sdk as Microsoft.NET.Sdk
.
Reference <FrameworkReference Include="Microsoft.AspNetCore.App"/>
searches for aspnet 2.0.0 when building:
SoftinuxBase.Security.Common -> F:\Developpement\Base\src\SoftinuxBase.Security.Common\bin\Debug\netcoreapp3.1\SoftinuxBase.Security.Common.dll
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '2.0.0' was not found.
- The following frameworks were found:
3.0.0 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
3.1.0 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
3.1.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>0.0.1</Version>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>SoftinuxBase.Security.Common</AssemblyName>
<RootNamespace>SoftinuxBase.Security.Common</RootNamespace>
<PackageId>SoftinuxBase.Security.Common</PackageId>
</PropertyGroup>
<PropertyGroup>
<LangVersion>8</LangVersion>
<CodeAnalysisRuleSet>..\..\StyleCopRules.ruleset</CodeAnalysisRuleSet>
<RepositoryUrl>https://github.com/SOFTINUX/Base</RepositoryUrl>
</PropertyGroup>
<ImportGroup Label="Documentation">
<Import Project="..\..\documentation.props" />
</ImportGroup>
<ItemGroup>
<AdditionalFiles Include="..\..\stylecop.json" />
</ItemGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
SDK .NET Core (refl茅tant tous les global.json)聽:
Version: 3.1.101
Commit: b377529961
Environnement d'ex茅cution聽:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.101\
Host (useful for support):
Version: 3.1.1
Commit: a1388f194c
.NET Core SDKs installed:
3.0.100 [C:\Program Files\dotnet\sdk]
3.1.100 [C:\Program Files\dotnet\sdk]
3.1.101 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
SDK:
3.0.100 [C:\Program Files\dotnet\sdk]
3.1.100 [C:\Program Files\dotnet\sdk]
3.1.101 [C:\Program Files\dotnet\sdk]
IDE:
vscode, visual studio 2019, rider 2019.3.1
Build mode: by command line with cleaning /bin, /obj folders before for give correct references
I use IAuthorizationFilter
for filter claims (from Identity)
Can you provide all of the code for the project? Seems like this is a class library (which isn't runnable)
@davidfowl yes, you can see here https://github.com/SOFTINUX/Base/tree/NewPermissionsSystem
It's like a partial app but I use Extcore to make that.
See the migration guide for https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.1&tabs=visual-studio.
You shouldn't have these packages on .NET Core 3.1 applications/libraries.
@davidfowl I have already followed this page.
I didn't commit my last work because it's not stable.
I have been busy migrating the project for 3 days.
The non-committed csproj file is the one I put in the issue.
If I declare the application as Microsoft.NET.Sdk.Web
, the application does not build because it claims for a Main entry point for this project.
It is for this reason that I set <FrameworkReference Include = "Microsoft.AspNetCore.App" />
I keep the application as a classlib and it has references to mvc because of IAuthorizationFilter
Hi,
I continue my investigations.
I discover that Visual Studio 2019 add's Microsoft.AspNetCore.App 2.1.15
after repairing.
So, you can never have this error when VS2019 is installed.
But, on Linux, you cannot have VS2019 and you have this error.
I suppose it's same on Mac.
@Xarkam Were you able to solve the problem? I have the same issue. It works good in VS2019 but fails in my codepipeline running on linux machine.
@Xarkam Were you able to solve the problem? I have the same issue. It works good in VS2019 but fails in my codepipeline running on linux machine.
When you install .NET Core SDK 3.1, it installs only the .NET Core SDK 3.1 and the runtime for 3.1 version. You doesn't get the 2.1.x runtime version. You must install it additionnaly to the .NET Core SDK 3.1.
And it's the same problem with mcr.microsoft.com/dotnet/core/sdk Docker image... it seems to contain only 3.1 runtime.
It's a bit odd because I don't think that case is properly documented somewhere...
What I understand is for some 2.x project (like ones using Razor), we must keep a runtime version of 2.1 on the system that builds the project.
It's a bit odd because I don't think that case is properly documented somewhere...
Why is that odd?
@davidfowl, maybe the word odd is not the right one.
What I wanted to say is more about the fact that when we have a webapi created with 2.1 sdk for example we can easily buid it using an image that contains only the .NET Core 3.1 sdk.
But if you have some razor pages created using 2.1 sdk you will not be able to achieve a build with .NET Core 3.1 sdk. You must get the runtime for 2.1 too to achieve that.
In the end, I think it's more something I didn't understand (or found in an official doc) about backward-compatibility or not of .NET Core 3.1 sdk with the previous ones.
Tagging @NTaylorMullen on this stale issue. I think the issue is that tools like rzc which used to be in packages didn't have automatic roll-forward to the next major runtime.
I'm pretty sure we addressed this in .NET 5.
I'm pretty sure we addressed this in .NET 5.
We've done a lot in the .NET 5 time frame and although I personally didn't do the work to enable it I wouldn't be surprised if it was fixed either.
@tremblaysimon would you mind trying to install the .NET 5 preview SDK to see if the issue persists? If it does that definitely wouldn't be ideal 馃槃
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.
See our Issue Management Policies for more information.
@NTaylorMullen, sorry I didn't give me time to try it now. I will try this today to see if it persists and give you feedback.
@NTaylorMullen, I tested it and got same error.
$ dotnet build test-dotnet21-razor/
Microsoft (R) Build Engine version 16.8.0-preview-20451-02+51a1071f8 pour .NET
Copyright (C) Microsoft Corporation. Tous droits r茅serv茅s.
Identification des projets 脿 restaurer...
Restauration effectu茅e de C:\Users\simon\workspace\test-dotnet21-razor\test-dotnet21-razor\test-dotnet21-razor.csproj (en 2,15 sec).
Vous utilisez une pr茅version de .NET Core. Consultez https://aka.ms/dotnet-core-preview
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '2.0.7' was not found.
- The following frameworks were found:
3.1.8 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
5.0.0-rc.1.20451.14 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=2.0.7&arch=x64&rid=win10-x64
C:\Users\simon\.nuget\packages\microsoft.aspnetcore.razor.design\2.1.2\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(69,5): error : rzc discover exited with code -2147450730. [C:\Users\simon\workspace\test-dotnet21-razor\test-dotnet21-razor\test-dotnet21-razor.csproj]
脡CHEC de la build.
C:\Users\simon\.nuget\packages\microsoft.aspnetcore.razor.design\2.1.2\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(69,5): error : rzc discover exited with code -2147450730. [C:\Users\simon\workspace\test-dotnet21-razor\test-dotnet21-razor\test-dotnet21-razor.csproj]
0 Avertissement(s)
1 Erreur(s)
Temps 茅coul茅 00:00:29.23
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.
See our Issue Management Policies for more information.
It's a real problem to have multiple versions of the sdk.
This implies that when you carry out an asp project in 2.1 that then you change the runtime to 3.1 in the csproj, somewhere, there is a strong relationship on the sdk / runtime 2.1
In the migration documentation 2.1 -> 3.1, nothing is indicated on this subject.
I can no longer confirm, but it seems to me that I had tested a template project in 2.1 directly passed to 3.1 without other modifications than those indicated in the documentation of migration from 2.1 to 3.1 and that the problem was present.
In release mode, do you have a full 3.1 package or a 2.1 / 3.1 mix?
@NTaylorMullen is it possible to reopen that issue?