42106

dotnet core Method 'ValidateOptions' … does not have an implementation

I'm building a .NET Core solution, which is building just fine, but when I try to publish it, it blows up with the following error:

Method 'ValidateOptions' in type 'Microsoft.CodeAnalysis.CSharp.CSharpCompilationOptions' from assembly 'Microsoft.CodeAnalysis.CSharp, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation. at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.Create at Microsoft.CodeAnalysis.Razor.CompilationTagHelperFeature.GetDescriptors() at Microsoft.AspNetCore.Razor.Language.DefaultRazorTagHelperBinderPhase.ExecuteCore(RazorCodeDocument codeDocument) at Microsoft.AspNetCore.Razor.Language.DefaultRazorEngine.Process(RazorCodeDocument document) at Microsoft.AspNetCore.Razor.Language.RazorTemplateEngine.GenerateCode(RazorCodeDocument codeDocument) 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()

On a higher verbosity, I get the following information (I don't know if this is significantly better):

1:10>Target "_RunForCore" in file "C:\Users\Jeremy Holovacs\.nuget\packages\microsoft.aspnetcore.mvc.razor.viewcompilation\2.0.2\build\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets" from project "D:\Projects\MySolution\MySolution.App\MySolution.App.csproj" (target "_MvcRazorPrecompile" depends on it): Using "GetDotNetHost" task from assembly "C:\Users\Jeremy Holovacs\.nuget\packages\microsoft.aspnetcore.mvc.razor.viewcompilation\2.0.2\build\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.dll". Task "GetDotNetHost" Done executing task "GetDotNetHost". Using "Exec" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Task "Exec" "C:\Program Files\dotnet\dotnet.exe" exec --runtimeconfig "D:\Projects\MySolution\MySolution.App\bin\netcoreapp2.0\MySolution.App.runtimeconfig.json" --depsfile "D:\Projects\MySolution\MySolution.App\bin\netcoreapp2.0\MySolution.App.deps.json" "C:\Users\Jeremy Holovacs\.nuget\packages\microsoft.aspnetcore.mvc.razor.viewcompilation\2.0.2\build\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.dll" @"obj\Debug\netcoreapp2.0\microsoft.aspnetcore.mvc.razor.viewcompilation.rsp" Method 'ValidateOptions' in type 'Microsoft.CodeAnalysis.CSharp.CSharpCompilationOptions' from assembly 'Microsoft.CodeAnalysis.CSharp, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation. at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.Create at Microsoft.CodeAnalysis.Razor.CompilationTagHelperFeature.GetDescriptors() at Microsoft.AspNetCore.Razor.Language.DefaultRazorTagHelperBinderPhase.ExecuteCore(RazorCodeDocument codeDocument) at Microsoft.AspNetCore.Razor.Language.DefaultRazorEngine.Process(RazorCodeDocument document) at Microsoft.AspNetCore.Razor.Language.RazorTemplateEngine.GenerateCode(RazorCodeDocument codeDocument) 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() 1:10>C:\Users\Jeremy Holovacs\.nuget\packages\microsoft.aspnetcore.mvc.razor.viewcompilation\2.0.2\build\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets(60,5): error MSB3073: The command ""C:\Program Files\dotnet\dotnet.exe" exec --runtimeconfig "D:\Projects\MySolution\MySolution.App\bin\netcoreapp2.0\MySolution.App.runtimeconfig.json" --depsfile "D:\Projects\MySolution\MySolution.App\bin\netcoreapp2.0\MySolution.App.deps.json" "C:\Users\Jeremy Holovacs\.nuget\packages\microsoft.aspnetcore.mvc.razor.viewcompilation\2.0.2\build\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.dll" @"obj\Debug\netcoreapp2.0\microsoft.aspnetcore.mvc.razor.viewcompilation.rsp"" exited with code 1. [D:\Projects\MySolution\MySolution.App\MySolution.App.csproj] Done executing task "Exec" -- FAILED. 1:10>Done building target "_RunForCore" in project "MySolution.App.csproj" -- FAILED. Done executing task "CallTarget" -- FAILED. 1:10>Done building target "MvcRazorPrecompile" in project "MySolution.App.csproj" -- FAILED. 1:10>Done Building Project "D:\Projects\MySolution\MySolution.App\MySolution.App.csproj" (Publish target(s)) -- FAILED. Build FAILED.

Can someone tell me what this is, and how I can stop it from blowing up? This just started happening recently, and I'm not aware of why I even need code analysis libraries for publishing.

This is happening on Windows and Linux with the latest .NET Core libraries (2.0.5 at the time I'm writing this).

Answer1:

OK, this was stupid, but it worked.

I started googling everything I could find as a keyword with this, and finally got an inkling on looking up github issues on microsoft.aspnetcore.mvc.razor.viewcompilation. This ultimately led me to the Razor view compilation and precompilation in ASP.NET Core page, which in turn has this nifty little warning:

Important

Razor view precompilation is currently unavailable when performing a self-contained deployment (SCD) in ASP.NET Core 2.0. The feature will be available for SCDs when 2.1 releases.

Now, that in itself doesn't tell you anything, other than it doesn't work, but following up, it sorta suggested adding a line like this:

<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>

...into my .csproj file.

Would you believe that worked? I consider this a complete fail on MS's part for blowing up in such a cryptic way and not having any documentation about what this error means, but basically, by default, when you publish, you precompile your razor views, but this basically isn't supported in .NET Core 2.0 from a command line or from linux... they expect it to be working by 2.1, but... well, let's just say I won't hold my breath.

Hopefully this helps out someone else banging their head against the wall, looking for answers about this.

Recommend

  • Getting Exception message in application insights
  • UnhandledException not called when exception thrown in another thread
  • Certificate error when configuring HttpClientFactory
  • show div after process register, woocommerce
  • dotnet core Method 'ValidateOptions' … does not have an implementation
  • Braintree Dropin UI does not work with Ionic Framework unless force refresh
  • android to show alert dialog from non-UI or Non activity class
  • Exception seems to be thrown repeatedly when debugging
  • How to update data into a file in a particular position in js
  • How to Moq this view?
  • how to connect to a mysql database through eclipse
  • How to read files recursively in Java 7?
  • const char **a = {“string1”,“string2”} and pointer arithametic
  • Exclusive access established by another Thread Java smartcardio
  • Visual Studio not stopping on an exception being thrown
  • Update a record where _id = :id with Mongoose
  • Easy way to convert a Bitmap and Png Image to text and vice versa
  • Convert C# statements including NSubstitute code to VB.net
  • Generic classes with Collection getter of other types
  • How do I add a File Type Association in a Windows Phone 8.1 app manifest?
  • runtime error when linking ffmpeg libraries in qt creator
  • Ionic storage “get” returns null only on the second call within method
  • multidatatrigger with multibinding in ControlTemplate.Triggers
  • Issue with routerLink directive
  • Ruby on Rails App deployed to heroku showing “We're sorry, but something went wrong”
  • Detecting null parameter in preprocessor macro
  • Cloud Code function running twice
  • Intel-64 and ia32 atomic operations acquire-release semantics and GCC 5+
  • Zoom in and out of jPanel
  • C# program and C++ DLL compiled for 32-bit system crash on 64-bit system
  • Firefox Extension - Monitor refresh and change of tab
  • Thread safety of a fluent like class using clone() and non final fields
  • Saving Changes After In-App Purchase Has Been Purchased
  • Converting a WriteableBitmap image ToArray in UWP
  • How to convert from System.Drawing.Color to Excel.ColorFormat in C#? Change comment color
  • javascript inside java/jsp code
  • To display the title for the current loaction in map in iphone
  • Android Studio and gradle
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • How can i traverse a binary tree from right to left in java?