Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Publish fails in visual studio 2017. #6833

Closed
ghost opened this issue Sep 15, 2017 · 13 comments
Closed

Publish fails in visual studio 2017. #6833

ghost opened this issue Sep 15, 2017 · 13 comments
Assignees

Comments

@ghost
Copy link

ghost commented Sep 15, 2017

Hi,
I want to publish an "ASP.Net MVC Core 2.0" project, which contains some library as references (They are not NuGets or projects). The project is working fine in the visual studio but it throws the following exception.

	Cannot find compilation library location for package 'Olive'
     at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths(ICompilationAssemblyResolver resolver, List`1 assemblies)
     at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths()
     at Microsoft.AspNetCore.Mvc.ApplicationParts.AssemblyPart.<>c.<GetReferencePaths>b__8_0(CompilationLibrary library)
     at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
     at Microsoft.AspNetCore.Mvc.Razor.Compilation.MetadataReferenceFeatureProvider.PopulateFeature(IEnumerable`1 parts, MetadataReferenceFeature feature)
     at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateFeature[TFeature](TFeature feature)
     at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorReferenceManager.GetCompilationReferences()
     at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)
     at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorReferenceManager.get_CompilationReferences()
     at Microsoft.AspNetCore.Mvc.Razor.Internal.LazyMetadataReferenceFeature.get_References()
     at Microsoft.CodeAnalysis.Razor.CompilationTagHelperFeature.GetDescriptors()
     at Microsoft.AspNetCore.Razor.Language.DefaultRazorTagHelperBinderPhase.ExecuteCore(RazorCodeDocument codeDocument)
     at Microsoft.AspNetCore.Razor.Language.RazorEnginePhaseBase.Execute(RazorCodeDocument codeDocument)
     at Microsoft.AspNetCore.Razor.Language.DefaultRazorEngine.Process(RazorCodeDocument document)
     at Microsoft.AspNetCore.Razor.Language.RazorTemplateEngine.GenerateCode(RazorCodeDocument codeDocument)
     at Microsoft.AspNetCore.Razor.Language.RazorTemplateEngine.GenerateCode(RazorProjectItem projectItem)
     at Microsoft.AspNetCore.Razor.Language.RazorTemplateEngine.GenerateCode(String path)
     at Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal.PrecompileRunCommand.<>c__DisplayClass23_0.<GenerateCode>b__0(Int32 i)
     at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
     at System.Threading.Tasks.TaskReplicator.Replica`1.ExecuteAction(Boolean& yieldedBeforeCompletion)
     at System.Threading.Tasks.TaskReplicator.Replica.Execute()
@pranavkm
Copy link
Contributor

@hamidmayeli this is likely a dup of https://github.com/dotnet/core-setup/issues/2981 (I think you're on that thread too). Does the workaround I listed there - https://github.com/dotnet/core-setup/issues/2981#issuecomment-322572374 - work for you?

@Eilon
Copy link
Member

Eilon commented Sep 15, 2017

Yup, looks exactly like https://github.com/dotnet/core-setup/issues/2981.

@Eilon Eilon closed this as completed Sep 15, 2017
@ghost
Copy link
Author

ghost commented Sep 16, 2017

Dear @Eilon and @pranavkm , It is the same error and I use a workaround for this issue and it is fixed only for debugging time. I need to publish and it fails on publishing time. Therefore, I think it is not a duplicated issue.

@Eilon
Copy link
Member

Eilon commented Sep 18, 2017

@pranavkm - any ideas?

@Eilon Eilon reopened this Sep 18, 2017
@pranavkm
Copy link
Contributor

Not off the top of my head. I'll investigate.

@proskilly
Copy link

I have the same issue, the workaround allowed me to run the project in VS but when I publish it I get an error
Cannot find compilation library location for package 'EntityFramework'
at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths(ICompilationAssemblyResolver resolver, List1 assemblies) at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths() at Microsoft.AspNetCore.Mvc.ApplicationParts.AssemblyPart.<>c.<GetReferencePaths>b__8_0(CompilationLibrary library) at System.Linq.Enumerable.<SelectManyIterator>d__162.MoveNext()
at Microsoft.AspNetCore.Mvc.Razor.Compilation.MetadataReferenceFeatureProvider.PopulateFeature(IEnumerable1 parts, MetadataReferenceFeature feature) at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateFeature[TFeature](TFeature feature) at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorReferenceManager.GetCompilationReferences() at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func1 valueFactory)
at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorReferenceManager.get_CompilationReferences()
at Microsoft.AspNetCore.Mvc.Razor.Internal.LazyMetadataReferenceFeature.get_References()
at Microsoft.CodeAnalysis.Razor.CompilationTagHelperFeature.GetDescriptors()
at Microsoft.AspNetCore.Razor.Language.DefaultRazorTagHelperBinderPhase.ExecuteCore(RazorCodeDocument codeDocument)
at Microsoft.AspNetCore.Razor.Language.RazorEnginePhaseBase.Execute(RazorCodeDocument codeDocument)
at Microsoft.AspNetCore.Razor.Language.DefaultRazorEngine.Process(RazorCodeDocument document)
at Microsoft.AspNetCore.Razor.Language.RazorTemplateEngine.GenerateCode(RazorCodeDocument codeDocument)
at Microsoft.AspNetCore.Razor.Language.RazorTemplateEngine.GenerateCode(RazorProjectItem projectItem)
at Microsoft.AspNetCore.Razor.Language.RazorTemplateEngine.GenerateCode(String path)
at Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Internal.PrecompileRunCommand.<>c__DisplayClass23_0.b__0(Int32 i)
at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.b__1()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.b__0(Object )
C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.razor.viewcompilation\2.0.0\build\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets(101,5): Error MSB3073: The command ""bin\Release\net461\win7-x86\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.exe" @"obj\Release\net461\win7-x86\microsoft.aspnetcore.mvc.razor.viewcompilation.rsp"" exited with code 1.

@proskilly
Copy link

proskilly commented Sep 19, 2017

As a work around I added this to my csproj file within the PropertyGroup section and it allowed me to publish the app
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>

@pranavkm
Copy link
Contributor

@hamidmayeli you would have to configure the same set of services to also work during design time. Precompilation supports this using IDesignTimeMvcBuilderConfiguration (See https://github.com/aspnet/MvcPrecompilation/blob/dev/testapps/ApplicationWithConfigureMvc/Startup.cs#L8). You'd move the snippet provided in https://github.com/dotnet/core-setup/issues/2981#issuecomment-322572374 into IDesignTimeMvcBuilderConfiguration.ConfigureMvc and that should work.

That said, there are issues with the way the tool loads the type which might require more refactoring (See aspnet/MvcPrecompilation#207)

@pranavkm
Copy link
Contributor

@hamidmayeli the other alternative is to disable precompilation the way @proskilly does.

@pranavkm
Copy link
Contributor

Closing this since once we have the service collection configured in IDesignTimeMvcBuilderConfiguration this does get resolved. Feel free to reopen if you have further concerns.

@varunthakur2480
Copy link

@proskilly Thanks I was able to fix it using the same tag
false

@jamsheedmp
Copy link

Thanks proskilly,
You saved my time.

@realnickivanov
Copy link

realnickivanov commented Jun 8, 2018

I got that error when I used <br> tag. Then I changed <br> to <br/> and it got fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants