GenerateRuntimeConfigurationFiles task failed unexpectedly on a project targeting netcoreapp1.0
See original GitHub issueSetup:
CLI Version : 2.0.0-preview1-005972 VS Version: d15rel 26507.0
Repro steps:
- Create a new Asp.NET Core Web application (1.0) in VS
- Add a global.json with
{ "sdk" : { "version": "1.0.4" } }
- Right click project -> Publish -> Folder -> Publish.
It fails with the error
C:\Program Files\dotnet\sdk\2.0.0-preview1-005972\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(134,5): Error MSB4018: The "GenerateRuntimeConfigurationFiles" task failed unexpectedly.
System.InvalidCastException: [A]NuGet.ProjectModel.LockFile cannot be cast to [B]NuGet.ProjectModel.LockFile. Type A originates from 'NuGet.ProjectModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'LoadFrom' at location 'C:\Program Files\dotnet\sdk\1.0.4\Sdks\Microsoft.NET.Sdk\tools\net46\NuGet.ProjectModel.dll'. Type B originates from 'NuGet.ProjectModel, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'LoadFrom' at location 'C:\Program Files\dotnet\sdk\2.0.0-preview1-005972\Sdks\Microsoft.NET.Sdk\tools\net46\NuGet.ProjectModel.dll'.
at Microsoft.NET.Build.Tasks.LockFileCache.GetLockFile(String path)
at Microsoft.NET.Build.Tasks.GenerateRuntimeConfigurationFiles.ExecuteCore()
at Microsoft.NET.Build.Tasks.TaskBase.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
GenerateRuntimeConfigurationFi...
I'm getting inconsistent errors when building my docker image. This fails approximately 1 out of 3 times, if i keep running docker build....
Read more >MSB4131 when building any ASP.NET Core 1.1 App
Verify the parameter exists on the task, and it is a gettable public instance property. This error appears whenever building ANY ASP.NET Core ......
Read more >Error MSB4018 - The Object of Your Affection
I have reached “Objects and Classes - Project - The Object of Your ... The "GenerateRuntimeConfigurationFiles" task failed unexpectedly.
Read more >NET SDK error list - .NET CLI
It cannot be referenced by a project that targets '{1}'. ... NET SDK includes '{0}' items from your project directory by default.
Read more >MSBuild reference for .NET SDK projects
The project file in the following example targets netstandard1.3 but uses the 1.6.0 version of NETStandard.Library .
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@nguerrera for the publish issue, the code is in tfs and we will fix it.
Moved to CLI because the resolver is implemented there.