Object reference not set to an instance of an object after publish
See original GitHub issueI’m having trouble when publishing my application. Published output doesn’t work, with error:
Object reference not set to an instance of an object
Steps to reproduce
- Create Empty ASP.NET Core Web Application (.NET Core)
- Setup simple project.json
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
}
},
"frameworks": {
"netcoreapp1.0": { }
},
"buildOptions": {
"emitEntryPoint": true
},
"runtimes": {
"osx.10.11-x64": { },
"win8-x64": { },
"win10-x64": { },
"ubuntu.14.04-x64": { }
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
dotnet restore
dotnet run
- “Hello world” is visible in browser at http://localhost:5000
- dotnet publish -r win8-x64 -o “c:\tmp\Publish”
- Navigate to output directory “c:\tmp\Publish”
dotnet run
dotnet run -p WebApplication4.dll
- doesn’t work either
Expected behavior
Application will start the same way as before publish
Actual behavior
Object reference not set to an instance of an object.
Environment data
dotnet --info
output:
.NET Command Line Tools (1.0.0-preview1-002702)
Product Information:
Version: 1.0.0-preview1-002702
Commit Sha: 6cde21225e
Runtime Environment:
OS Name: Windows
OS Version: 6.2.9200
OS Platform: Windows
RID: win8-x64
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Publish Errors -> Object reference not set to an instance of ...
I installed SSMS 17.8, deinstalled SSM 16, and repaired JetBrains, after that rebooted. The issue is now gone. I repair the publish file...
Read more >Error when I click publish | "Object reference not set to an ...
I'm trying to publish the files of a project I just created in Visual Studio 2012. ... Already created a new web project...
Read more >Fix: "Object Reference Not Set to an Instance of ...
If you receive the "Object reference not set to an instance of an object" error on your Windows computer, it might be caused...
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 >Solved: Can't publish - Object reference not set to an ins...
I have a couple of reports that I update monthly and then publish and share the dashboard. No major changes this month -...
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 FreeTop 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
Top GitHub Comments
To run a published application, don’t use
run
, justdotnet myapp.dll
.Ugh, @tmds thank you 😃