When I publish my ASP.NET Core (v1.0.0) MVC 6 app, it fails to run successfully when viewing any page (ie, the server/host starts up fine but throws an error when a GET request is made). When starting the app at the command prompt, I can see that it complains about a missing DLL. I added the missing DLL to the published directory (where the app is hosted by IIS/Krestel) and then it complained about another DLL, and then another, and so on. Ultimately, it needed the following DLL's before everything ran successfully:
Microsoft.DotNet.Cli.Utils.dll
Microsoft.DotNet.ProjectModel.dll
Microsoft.Extensions.CommandLineUtils.dll
NuGet.Common.dll
NuGet.Configuration.dll
NuGet.DependencyResolver.Core.dll
NuGet.Frameworks.dll
NuGet.LibraryModel.dll
NuGet.Packaging.Core.dll
NuGet.Packaging.Core.Types.dll
NuGet.Packaging.dll
NuGet.ProjectModel.dll
NuGet.Protocol.Core.Types.dll
NuGet.Protocol.Core.v3.dll
NuGet.Repositories.dll
NuGet.RuntimeModel.dll
NuGet.Versioning.dll
I'm not sure why the NuGet DLL's are required for a published web app or why this is even happening at all. Obviously Visual Studio should take care of this sort of thing for us. For now when I publish I don't have it clear all files first (so the DLL's I manually copied stay there) but I would like to know why, if these DLL's are needed, are they not included as part of the deploy process?
Here is my project.json, in case that helps:
{
"dependencies": {
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.AspNetCore.Session": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Serilog.Extensions.Logging": "1.2.0",
"Serilog.Sinks.File": "2.2.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"System.Data.Common": "4.1.0",
"System.Data.SqlClient": "4.1.0",
"System.DirectoryServices.Linq": "1.2.2.1",
"Microsoft.Extensions.Logging.Filter": "1.0.0",
"BundlerMinifier.Core": "2.2.281"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"net462": {}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"configurations": {
"DEV": {
"compilationOptions": { "define": [ "DEV" ] },
"buildOptions": { "define": [ "DEV" ] }
},
"PROD_SRV": {
"compilationOptions": { "define": [ "TEST_SRV" ] },
"buildOptions": { "define": [ "TEST_SRV" ] }
},
"PROD_SRV_DEV": {
"compilationOptions": { "define": [ "TEST_SRV_DEV" ] },
"buildOptions": { "define": [ "TEST_SRV_DEV" ] }
},
"TEST": {
"compilationOptions": { "define": [ "TEST" ] },
"buildOptions": { "define": [ "TEST" ] }
},
"TEST_SRV": {
"compilationOptions": { "define": [ "TEST_SRV" ] },
"buildOptions": { "define": [ "TEST_SRV" ] }
},
"TEST_SRV_DEV": {
"compilationOptions": { "define": [ "TEST_SRV_DEV" ] },
"buildOptions": { "define": [ "TEST_SRV_DEV" ] }
}
}
}
Any ideas?
Thanks guys and gals!
Well, I fixed the problem. I created a new ASP.NET Core (.NET Framework) web application project and was able to publish without issue. So I compared the values in the project.json/global.json files with the versions in my project. I updated all the versions to the latest version in project.json, but that didn't fix it. But after updating key "sdk:version" in global.json to "1.0.0-preview2-003131" it worked. I can't believe that was the issue, but it worked.
After a lot of headache I was also able to get Web Deploy to work as well. Too much effort just to publish!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With