question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet publish - NullReferenceException

See original GitHub issue

Steps to reproduce

dotnet -v publish

Expected behavior

Create packages to deploy

Actual behavior

Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.DotNet.ProjectModel.ProjectModelPlatformExtensions.CollectDependencies(IDictionary2 exports, IEnumerable1 dependencies, HashSet1 exclusionList) at Microsoft.DotNet.ProjectModel.ProjectModelPlatformExtensions.CollectDependencies(IDictionary2 exports, IEnumerable1 dependencies, HashSet1 exclusionList) at Microsoft.DotNet.ProjectModel.ProjectModelPlatformExtensions.CollectDependencies(IDictionary2 exports, IEnumerable1 dependencies, HashSet1 exclusionList) at Microsoft.DotNet.ProjectModel.ProjectModelPlatformExtensions.CollectDependencies(IDictionary2 exports, IEnumerable1 dependencies, HashSet1 exclusionList) at Microsoft.DotNet.ProjectModel.ProjectModelPlatformExtensions.GetPlatformExclusionList(ProjectContext context, IDictionary`2 exports) at Microsoft.DotNet.Tools.Publish.PublishCommand.PublishProjectContext(ProjectContext context, String buildBasePath, String outputPath, String configuration, Boolean nativeSubdirectories) at Microsoft.DotNet.Tools.Publish.PublishCommand.PublishAllProjects() at Microsoft.DotNet.Tools.Publish.PublishCommand.<>c__DisplayClass0_0.<Run>b__0() at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args) at Microsoft.DotNet.Tools.Publish.PublishCommand.Run(String[] args)

Environment data

dotnet --info output: .NET Command Line Tools (1.0.0-preview2-002900)

Product Information: Version: 1.0.0-preview2-002900 Commit SHA-1 hash: f4ceb1f213

Runtime Environment: OS Name: Windows OS Version: 10.0.14342 OS Platform: Windows RID: win10-x64

restore/build/run running without errors

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
blackdwarfcommented, Jun 20, 2016

I think it could do with the fact that Microsoft.NETCore.App is put in the dependencies and project.json (at least the one posted above, thanks @Tazer) targets net461. @Tazer did dotnet restore run on that project.json successfuly?

0reactions
CezaryRynkowskicommented, Jul 4, 2016

This solution unfortunetly no, but new dotnet RTM resolved 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Null reference exception when publishing an app
I have an application AppFoo that utilizes user controls from MyDLL.dll file. When I run AppFoo from Visual Studio, everything works fine. If...
Read more >
dotnet publish quite often fails with System. ...
NullReferenceException : Object reference not set to an instance of an object. at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.
Read more >
Visual Studio 2019 throws NullReferenceException when ...
When trying to access the “Publish Project” interface in Visual Studio 2019, VS throws a NullReferenceException: System.
Read more >
NullReferenceException Class (System)
This exception occurs if you assume that each element of the array must contain a non-null value, and the value of the array...
Read more >
Object Reference Not Set to an Instance of an Object
This exception is thrown when you try to access a member—for instance, a method or a property—on a variable that currently holds a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found