1.I want to publish my company's asp.net core 2.0 project on linux centos 7.2.
2.so the 2.0.3 sdk is installed by following the offical guidline.
2.I execute "dotnet publish '/data/companyproject.csproj' -c release -f netcoreapp2.0 -o '/out/dir' "
publish success, and I can see the files published in the '/out/dir'
an error shows at the end of the shell:
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '1.0.0' was not found.
- Check application dependencies and target a framework version installed at:
/
- Alternatively, install the framework version '1.0.0'.
dotnet --info output:
.NET Command Line Tools (2.0.3)
Product Information:
Version: 2.0.3
Commit SHA-1 hash: eb1d5ee318
Runtime Environment:
OS Name: centos
OS Version: 7
OS Platform: Linux
RID: centos.7-x64
Base Path: /usr/share/dotnet/sdk/2.0.3/
Microsoft .NET Core Shared Framework Host
Version : 2.0.3
Build : a9190d4a75f4a982ae4b4fa8d1a24526566c69df
investigation:
after the .net core sdk installed, I use "dotnet new mvc" ->"dotnet restore"->"dotnet build"->"dotnet publish", all of them work fine.
this is my csproj file.
csprojfile.txt
the same problem can repro in my local windows machine, but it works fine after 1.1 sdk installed.
How can i investigate this problem?
I believe the problem here is this:
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
<Exec Command="dotnet bundle" />
</Target>
And I can see you are referencing a particular version of the bundle tool that targeted the 1.0.0 runtime, thus giving you this error.
cc @mlorbetske @prafullbhosale to confirm or deny my hypothesis above.
That is correct. The PrepareForPublish target is executed during dotnet publish and the 1.0 version of the DotNetCliToolReference is causing the error to show up.
@ZhiqiangTao can you try to update the DotNetCliToolReference to a newer version?
<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.301" />
Version 2.5.357 and higher support 2.0 runtime.
thanks all, it works fine for me
Most helpful comment
That is correct. The
PrepareForPublishtarget is executed duringdotnet publishand the 1.0 version of the DotNetCliToolReference is causing the error to show up.@ZhiqiangTao can you try to update the DotNetCliToolReference to a newer version?
Version 2.5.357 and higher support 2.0 runtime.