I'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
{
"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 restoredotnet rundotnet rundotnet run -p WebApplication4.dll - doesn't work eitherApplication will start the same way as before publish
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
It should generate and run with WebApplication4.exe (no dotnet ... call required for standalone apps).
The nullref comes from run not finding a project.json/project.lock.json and afaik has been fixed in newer builds.
@dasMulli is right. For a standalone app, you will get an EXE file that you run.
Can you try with the latest builds and see if the dotnet run behavior is correct (not throwing)?
preview2 does indeed include a fix:
The current project is not valid because of the following errors:
/Users/piotrp/.dotnet(1,0): error DOTNET1017: Project file does not exist '/Users/piotrp/.dotnet/project.json'.
I've followed this issue and pulled the latest build and I get the fix but I still don't get a standalone .exe, what have I missed ?
@johnkattenhorn can you share your project.json?
Hey @blackdwarf, I figure it out just now, I needed to remove the platform line from the project.json.
Thanks for following it up
To run a published application, don't use run, just dotnet myapp.dll.
Yep, I was reading some comments in the dotnet run not run in here earlier. I can see why it's confusing for people.
Ugh, @tmds
thank you :)
Most helpful comment
To run a published application, don't use
run, justdotnet myapp.dll.