I was looking for about 3 days and I found no solution for my problem. We have a web app which shall be published to the IIS. For this case we have a batch file which runs a ps1-file with Powershell.exe which runs dotnet publish.
When I run this publish script and it runs "dotnet publish", I get the following output:
Publishing WebAuthServer for .NETFramework,Version=v4.6.1/win7-x64
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.CommandLineUtils, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Das System kann die angegebene Datei nicht finden.
at Microsoft.AspNetCore.Server.IISIntegration.Tools.Program.Main(String[] args)
The project.json looks like the following:
"dependencies": {
"IdentityServer4": "1.0.0-beta5",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"net461": {
"imports": [ "dnx451" ]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true,
"languageVersion": "csharp6"
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"config.json",
"config.default.json",
"config-schema.json",
"web.config",
"WebAuthServerSigning.pfx"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
When I delete our global nuget packages folder and restore the nuget packages with "dotnet restore", it puts the IISIntegration-Tools into the .tools folder.
When I tried "1.0.0-preview1-final" of the IIS integration tools, the publishing went without errors, but the result gave me a 502 error in the browser.
I also tried to delete the project.lock.json.
I also tried putting Microsoft.Extensions.CommandLineUtils into the dependencies section.
The project.lock.json restored itself with the following information for the tools section:
"tools": {
".NETCoreApp,Version=v1.0": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools/1.0.0-preview2-final": {
"type": "package",
"dependencies": {
"Microsoft.DotNet.ProjectModel": "1.0.0-rc3-003121",
"Microsoft.Extensions.CommandLineUtils": "1.0.0",
"Microsoft.NETCore.App": "1.0.0",
"System.Diagnostics.Process": "4.1.0"
},
"compile": {
"lib/netcoreapp1.0/dotnet-publish-iis.dll": {}
},
"runtime": {
"lib/netcoreapp1.0/dotnet-publish-iis.dll": {}
}
}
}
},
"projectFileToolGroups": {
".NETCoreApp,Version=v1.0": [
"Microsoft.AspNetCore.Server.IISIntegration.Tools >= 1.0.0-preview2-final"
]
}
The lines in our script for building and publishing are:
. dotnet build $projectPath --configuration Release --no-dependencies
. dotnet publish $projectPath --framework net461 --output $tempPath --configuration Release --no-build
I really do not know, why the CommandLineUtils seem to be missing here.
Do you have any idea what could be wrong here?
Thank you very much in advance!
Edit:
We have a working copy of the nuget dependency in our git repository. But I don't know, why it compiled different approximately a year ago. When I compile our project, I get a Microsoft.AspNetCore.Server.IISIntegration.Tools.deps.json in our .tools folder of the nuget folder. When I compare the old one with the new one, in the working version sometimes is a runtime section, which is not in the new one.
Here one example. The old, working Microsoft.AspNetCore.Server.IISIntegration.Tools.deps.json file:
"Microsoft.AspNetCore.Server.IISIntegration.Tools/1.0.0-preview2-final": {
"dependencies": {
"Microsoft.DotNet.ProjectModel": "1.0.0-rc3-003121",
"Microsoft.Extensions.CommandLineUtils": "1.0.0",
"Microsoft.NETCore.App": "1.0.0",
"System.Diagnostics.Process": "4.1.0"
},
"runtime": {
"lib/netcoreapp1.0/dotnet-publish-iis.dll": {}
}
},
And here is the non-working file without the runtime section:
"Microsoft.AspNetCore.Server.IISIntegration.Tools/1.0.0-preview2-final": {
"dependencies": {
"Microsoft.DotNet.ProjectModel": "1.0.0-rc3-003121",
"Microsoft.Extensions.CommandLineUtils": "1.0.0",
"Microsoft.NETCore.App": "1.0.0",
"System.Diagnostics.Process": "4.1.0"
}
},
Do you maybe have any idea for this with this information?