dotnet / runtime

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

InvalidOperationException: Cannot find compilation library location for package #3014

Closed ngohungphuc closed 4 years ago

ngohungphuc commented 6 years ago

I have tried @pakrym solution in my project

ReferenceFeatureProvider.cs

and in this

I will get this error InvalidOperationException: Cannot find compilation library location for package 'AwesomeCMSCore.Modules.API'.

image

Is there anyway to work around this

steveharter commented 6 years ago

cc @eerhardt

ngohungphuc commented 6 years ago

In my web api project I have to add to fix it

<PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <PreserveCompilationContext>false</PreserveCompilationContext>
    <EnableDefaultContentItems>false</EnableDefaultContentItems>
    <OutputType>WinExe</OutputType>
    <ApplicationIcon />
    <StartupObject />
  </PropertyGroup>
steveharter commented 6 years ago

@ngohungphuc this should be fixed in the 2.0.3 release of the runtime (November 2017); this doesn't require setting PreserveCompilationContext=false

What version of the runtime do you have?

ngohungphuc commented 6 years ago

@steveharter my dotnet version is 2.1.4

steveharter commented 6 years ago

Are you trying to add a new reference resolver or just use the existing one?

ngohungphuc commented 6 years ago

which reference resolver you want to mention @steveharter

steveharter commented 6 years ago

I'm not sure if you are trying to add a new file-reference resolver (note we also have other "resolvers" including package resolvers and project resolvers) or if you are simply trying to use the existing file reference resolver and are having issues with that.

eerhardt commented 6 years ago

@ngohungphuc - @pakrym's solution (I think you mean @pranavkm) is no longer necessary with ASP.NET Core 2.0.3 or greater. Can you successfully run your app without that code?

ngohungphuc commented 6 years ago

@eerhardt I cant

eerhardt commented 6 years ago

This should be investigated for 2.1.

pranavkm commented 6 years ago

<PreserveCompilationContext>false</PreserveCompilationContext> That might be the cause of the issue. Try setting it to true

eerhardt commented 6 years ago

@ngohungphuc - I pulled the master branch of https://github.com/Awesome-CMS-Core/Awesome-CMS-Core/, and the app seemed to run I think. I got a 404 not found when hitting the home page. But I didn't get the error you describe.

Can you give me a solid set of repro steps to investigate this issue? Assume that I know nothing about your project, and how to set it up to run. It would be best if you could make a branch or something that all I needed to do was pull the branch, hit F5, and I see the exception.

eerhardt commented 6 years ago

Closing for now, until we get a solid set of repro steps to repro the issue.