Skip to content

How to reference Azure SDK dlls in project.json? #1317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
am11 opened this issue Feb 22, 2016 · 1 comment
Closed

How to reference Azure SDK dlls in project.json? #1317

am11 opened this issue Feb 22, 2016 · 1 comment

Comments

@am11
Copy link
Member

am11 commented Feb 22, 2016

The official Azure SDK assemblies are not available via NuGet.

Under aspnet-core Web API project, which is configured to run as a worker role on Azure, I have used "Bin syntax" (https://github.com/aspnet/Home/wiki/Project.json-file#bin-syntax-wrapping-a-dll) in project.json as follow:

"frameworks": {
  "dnx451": {
    "dependencies": {
        " /* eradicated for brevity */ "
    },
    "bin": {
      "assembly": "C:\\Program Files\\Microsoft SDKs\\Azure\\.NET SDK\\v2.8\\ref\\Microsoft.WindowsAzure.ServiceRuntime.dll"
    }
  }
},

In WorkerRole.cs, I am getting Cannot resolve symbol 'ServiceRuntime' at using Microsoft.WindowsAzure.ServiceRuntime.dll.

  • Is this usage flawed?
  • In cases such as these, when NuGet package is not an option provided by vendor, can we add assembly in source tree and reference it with relative path in project.json?
  • Is there another (better, special) way to handle Azure SDK assemblies?
@am11
Copy link
Member Author

am11 commented Feb 22, 2016

Found the solution:

I created a Class Library (package) project (AzureSDKServiceRuntimeWrapper), which wraps the Microsoft.WindowsAzure.ServiceRuntime.dll, added a project.json with following content:

{
  "frameworks": {
    "dnx451": {
      "bin": {
        "assembly": "C:\\Program Files\\Microsoft SDKs\\Azure\\.NET SDK\\v2.8\\ref\\Microsoft.WindowsAzure.ServiceRuntime.dll"
      }
    }
  }
}

Then referenced this project in Web API project's project.json:

"frameworks": {
  "dnx451": {
    "dependencies": {
      "AzureSDKServiceRuntimeWrapper": "1.*"
      ".. other dependencies.."
    }
  }
}

Finally, worked on postbuild event to copy the API project assembly in two places: from "artifacts/bin/{projectname}/{configuration}/{tfm}/{projectname}.dll" to "artifacts/bin/{projectname}/{configuration}/" and "artifacts/obj/{projectname}/{configuration}" (the latter one is required by worker role's .targets file provided by v2.8 SDK). The worker role application is now packagable and hence publishable (although facing some further hiccups once package gets restored on Azure; i.e. worker role is continuously rebooting, but I will manage to investigate it further).

Would be nice to clarify the wrapper project aspect in docs. I would happy to send a (reviewable) PR if there is a repo with docs in the source tree. :)

@am11 am11 closed this as completed Feb 22, 2016
natemcmaster pushed a commit that referenced this issue Dec 1, 2018
Rename Owin version property for consistency (#1317)
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant