Set .NET framework version -- value of argument "obj" is null

Hi,
I’m using beta.2 and trying to deploy ASP.NET Core project, by your manuals:
http://docs.octopusdeploy.com/display/OD/Deploying+ASP.NET+Core+Web+Applications

So, by recommendation from MS i set field “.NET CLR version” to custom value with this text “No Managed Code” and got an error while trying to execute deploying.
Then i tried to recreate step with value “v 4.0” in this field and got the same error again. Have a look at attached log file.

P.S.
And when i opened saved step i didn’t see a custom expression because checkbox that showed custom expression in field “.NET CLR version” is off.
P.P.S
In your manual have a picture with window “Enabled features” and there have a row “AppSettings JSON” but actually in beta.2 this row named “JSON configuration variables” and enabled feature on page “step” looks differently.

ServerTasks-1765.log.txt (9 KB)

Hi,

Thank you for trying ASP.NET Core deployments with the 3.3 beta.

It looks like the application pool version is not being set correctly when IIS is being set up. For my ASP.NET Core web site (beta 4) I use application pool version 4.0. To help diagnose the problem would you be able to send the deployment process JSON for the project you are trying to deploy? You can find the deployment process by navigating to /api/projects and then following the link in your project to the deployment process.

Thanks for letting us know that our documentation is out of date, we will update it shortly.

Cheers,
Shane

Hi,
Shane.

I’m not sure that understand you.
There are two different json files in project:
approot\packages\OrangeIntegrationApp\1.0.0\root\appsettings.json
approot\packages\OrangeIntegrationApp\1.0.0\app\project.json
In “Step details” I’m set field “Target files” to
approot\packages\OrangeIntegrationApp\1.0.0\root\appsettings.json
how it’s recommended in manual.
Do you want me to upload this file?
I cleared some private information and attached it.

Cheers,
Vitaliy

appsettings.json (594 Bytes)

Hi Vitaliy,

Thanks for sending through your appsettings.config. I am interest in seeing the deployment process for your ASP.NET Core project. You can send it by going to the Octopus Deploy api and finding your project:
http://YOUR_OCTOPUS/api/projects
Once you have found your project there is a link in the JSON to the deployment process. Something like this:
DeploymentProcess: "/api/deploymentprocesses/deploymentprocess-Projects-41"
Could you follow that link and send the JSON of the deployment process? You should end up at something like:
http://YOUR_OCTOPUS/api/deploymentprocesses/deploymentprocess-Projects-41.

Thanks,
Shane

Hi, Shane.

Thank you for your patience!
Here you go.

Cheers,
Vitaliy

DeploymentProcess.json (3 KB)

Hi Vitaliy,

Thank you for sending your deployment process. I can not find anything unusual about it, I would expect it to set up your app pool correctly. In your deployment log there is a line:

Set .NET framework version:

It should have the framework version displayed there.

Could you add the following variable to your project variables, create and deploy a new release and send the deployment log again? It will output all of your variables for the step and that might help determine why no application pool version is being set.

Variable
Name: OctopusPrintVariables Value: true

Thanks,
Shane

Hi, Shane.

Now, it’s working, thanks!
I tried to catch error again and did set field “Set .NET framework version:” to custom value “No Managed Code” and I have new release without any error.
Is the reason of the issue that I haven’t created new release every time any steps were changed?

If you don’t mind, I have one more question:
As a manual recommends, we are launching “Start-Process $startWebAppCommand” in next step after “deploy” step. Does Octopus stops previous version of this application automatically when configuring IIS server for new version or do I need to do something?

Cheers,
Vitaliy

I have found an order of actions to reproduce my error:

  1. Create step with feature “Deploy IIS”
  2. Select “Use a custom expression” in field “.NET CLR version” and set expression to “No Managed Code”
  3. Save step.
  4. Edit step again and change something else.
  5. Save step.
  6. Start deploy of release and you get error “Set .NET framework version – value of argument “obj” is null”

Hi Vitaliy,

I’m glad to hear that you have got it working.

Thanks for providing the steps to reproduce the error you were getting.

Cheers,
Shane

The value should be “” (empty string) but selecting nothing sets it to null, I had this working before with 3rd party script templates from the library but they’re not nearly as nice as the Deploy step in Octopus Deploy. I also can’t find a way to get Octopus to use an empty string instead of null using an expression.

We really need to map a “No Managed Code” to an empty string value as part of that pulldown list.

(I’m in the middle of writing up an article on how you get Octopus Deploy working with .NET Core, but I really wanted to get the default Deploy process step to work right vs. all these third party powershell scripts that limit options)

I’d be glad to try any betas or patches that remedy this issue.

This is my post deploy script:

#Load Web Admin DLL
[System.Reflection.Assembly]::LoadFrom( "C:\windows\system32\inetsrv\Microsoft.Web.Administration.dll" )
Add-PSSnapin WebAdministration -ErrorAction SilentlyContinue
Import-Module WebAdministration -ErrorAction SilentlyContinue
$iis = (New-Object Microsoft.Web.Administration.ServerManager)
$pool = $iis.ApplicationPools | Where {$_.Name -eq $OctopusParameters['Octopus.Action[Deploy].IISWebSite.ApplicationPoolName']} | Select-Object -First 1
$pool.ManagedRuntimeVersion = ""

That fixes the runtime version after deploy.

A github issue was created to add support for “no managed code”: https://github.com/OctopusDeploy/Issues/issues/2443