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

Running precompilation tool on an Empty Web Application fails #162

Closed
pranavkm opened this issue Jul 5, 2017 · 4 comments
Closed

Running precompilation tool on an Empty Web Application fails #162

pranavkm opened this issue Jul 5, 2017 · 4 comments
Labels

Comments

@pranavkm
Copy link
Contributor

pranavkm commented Jul 5, 2017

Repro steps

From VS,

  1. File > New Project > ASP.NET Core Web Application > Empty (.NET Core) - 2.0.
  2. Publish to Folder

Publishing fails with

EXEC(0,0): Warning CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options.
EXEC(1,11): Error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
EXEC(1,54): Error CS0518: Predefined type 'System.String' is not defined or imported

The deps file is missing references to Microsoft.NETCore.App \ System.Runtime.dll which causes the assembly emit to fail.

@DamianEdwards
Copy link
Member

Eeep, that's really bad. What's the root cause you think?

@pranavkm
Copy link
Contributor Author

pranavkm commented Sep 7, 2017

This might have been fixed in the templates. The issue was that Empty Web had PreserveCompilationContext disabled (dotnet/templating@3403726). Usually we'll print a message saying you are missing this when a view fails to compile. In the absence of any views, we only compile an auto-generated AssemblyInfo that fails this way. The simplest fix, IMO, is to no-op the tool if there aren't things to compile.

@mkArtakMSFT
Copy link
Member

We're not going to make any other significant enhancements to this feature, as we'll be replacing it with a better one.

@rocklan
Copy link

rocklan commented Apr 6, 2018

This is also a problem if you create a WebApi project with no views, so I'm not sure why this issue is closed when it's still a bug.. but as a workaround, adding the following to my .csproj fixed the problem for me:

<PropertyGroup>
    <MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
    <PreserveCompilationContext>false</PreserveCompilationContext>
</PropertyGroup>

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

No branches or pull requests

4 participants