I've upgraded from .NET Core 2.0 to 2.1.1.
I built my project and now I'm getting this error:
Cannot find compilation library location for package 'Microsoft.NETCore.App'
I don't know what other information should I provide. Please guide me in providing more info on this issue.
It's such a frustrating experience. Upgrading backward compatible version in Semantic Versioning shouldn't break things. I wish you had versioned this release as .NET Core 3.0, so that we wouldn't upgrade. Any help?
@nefcanto , can you include output from dotnet --info so we can see a bit of your environment?
@dsplaisted
Yeah, sure.
@nefcanto It looks like there may be something wrong with your .NET Core SDK installation. Instead of the error message at the beginning of the output of dotnet --info, you should be seeing something like this:
.NET Core SDK (reflecting any global.json):
Version: 2.1.301
Commit: 59524873d6
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.301\
Do you have this file on your machine? C:\Program Files\dotnet\sdk\2.1.301\runtimes\win\lib\netcoreapp2.0\System.Text.Encoding.CodePages.dll
Can you try repairing (or uninstalling and then reinstalling) the 2.1.301 .NET Core SDK?
Thanks
@dsplaisted no I checked and I don't have that file on my machine. Though I have this file:
C:\Program Files\dotnet\sdk\2.1.301\Roslyn\bincore\runtimes\win\lib\netstandard1.3\System.Text.Encoding.CodePages.dll
Today I'll uninstall/reinstall SDK to see what will happen. Thank you.
I uninstalled all runtimes and SDKs installed on my machine from previous versions and including the current version. And then reinstalled the SDK. Here is a screenshot of the SDK:
But the problem is that now I can't build my applications. It complains that:
MSB4236 The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.
Unable to locate the .NET Core SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.
Well I restarted my PC, and now project is built. But again back to the original problem, I see:
Cannot find compilation library location for package 'Microsoft.NETCore.App'
OK, sorry this is still not working for you.
Do you get the failure if you create a new project from a template?
Can you enable more detailed output to provide more details about the failure?
Can you share a binary log of your build? You can create a binary log by building with the -bl parameter, it will then create a file called msbuild.binlog. That file is very useful for debugging build issues, however note that it includes very detailed information about your build (including the contents of your project files, your environment variables, and the inputs and outputs of all the targets and tasks that were run), so depending on your project you may not be able to share all that information. You can download a viewer for the .binlog files at http://msbuildlog.com/ if you would like to look at what's in them yourself.
For those who encounter the same problem, I had to add this to my csproj to make things work. Sorry @dsplaisted I couldn't do what you asked for. So I had to search and I had to spend a huge amount of time, to make things work. I don't know even why it worked, but it worked.
<PropertyGroup>
<RuntimeFrameworkVersion>2.1.1</RuntimeFrameworkVersion>
</PropertyGroup>
Thanks for posting your solution @nefcanto.
@dsplaisted @leecow do we need to update any docs / FAQs for this? Is this issue safe to close now?
Unfortunately it's still no clear what the root cause was here. So I wouldn't update docs unless we understand what's going on. But since @nefcanto was able to get things working, I think we can close the issue.
I also encountered the same problem when I first migrated from 2.0 to 2.1.
Be sure you checked the "Publish > Settings > File Publish Options > Remove additional files at destination" option (if you publishing manually). I think some files is breaking the whole application.
Now same problem happens when I publish a single *.cshtml file even I've tried the csproj editions.
@kaansengul you are right, Remove additional files at destination will fix the problem but you will lose WebJobs
You do not need to change the publish options, just once removing all dll's, service references, and runtimes manually is enough. You can keep configuration files, wwwroot, etc. Then publish again. Apparently there is an old 2.0 dll which needs to be manually removed.
I got this issue when publishing a single razor file (layout) I won't make that mistake again! Remove additional files at destination fixed it for me
Hi, I am having the same issue.
dotnet --info shows me:
.NET Core SDKs installed: 2.1.4 to 2.1.500
.NET Core runtimes installed:
Microsoft.AspNetCore.All: 2.1.2 to 2.1.6
Microsoft.AspNetCore.App 2.1.2 to 2.1.6
Microsoft.NETCore.App 2.0.5 to 2.1.6
In csproj:
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
<MvcRazorPrecompile >true</MvcRazorPrecompile>
<PreserveCompilationContext>true</PreserveCompilationContext>
<RuntimeFrameworkVersion>2.1.6</RuntimeFrameworkVersion>
I can run the project perfectly from vstudio, however when I use dotnet publish (locally) and then run it from the "publish" folder I get:
_The view 'Index' was not found. Searched locations: /Views/Home/Index.cshtml, /Views/Shared/Index.cshtml, /Pages/Shared/Index.cshtml_
There is a xxxxx.PrecompiledViews.dll file in the publish folder and when I JustDecompile the views dll:

And the main dll I see:

So as far as I can work out all of the files are embedded correctly and they work when running from IISExpress, jut not when run as a published app. I have published to azure and get the same error in the azure logging console so I have missed something somewhere along the way.
@chillfire that looks like a different type of issue.
Agreed, looks like different problem - please create isolated minimal repro and file a new bug. Likely on ASP.NET repo.
I'm getting this error from self contained Windows application on machines without .NET core installed. Any ideas?
I had this issue on an ASP.NET Core MVC 2.1 application when publishing and deploying to Docker using the default 2.1 tag (Debian based). Problem was fixed by adding the following to my csproj file:
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
However, it's not really clear to me yet why this issue occurs. Similar other MVC 2.1 projects doesn't require this directive, even they run in the same Docker environment.
I had this issue on an ASP.NET Core MVC 2.1 application when publishing and deploying to Docker using the default 2.1 tag (Debian based). Problem was fixed by adding the following to my csproj file:
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>However, it's not really clear to me yet why this issue occurs. Similar other MVC 2.1 projects doesn't require this directive, even they run in the same Docker environment.
yeah! this solved problem in our case! thx
Most helpful comment
I got this issue when publishing a single razor file (layout) I won't make that mistake again! Remove additional files at destination fixed it for me