简体   繁体   中英

CDKTF C# how to include providers that do not have a pre-built provider - namespace confusion

I am new to C# and I've been able to build out an application for a client using the pre-built providers for CDKTF and Azure. My question is when there is not a pre-built provider, how do I include the bindings in my code? I see that with typescript it's as simple as import { YourProvider } from './gen/providers/<yourprovider>/provider'; (referenced from here ).

The problem is that in C#, it's not so straightforward it seems. I have been searching for the answer but haven't found anything yet. I think that it might be such a basic question that it's difficult to find someone asking the question, or I don't know the proper terminology to be able to find it. I also tried ChatGPT but it's explanations weren't on point (implying the issue is my lack of understanding/proper vocabulary)

I see that the provider exists at .gen/azuredevops/azuredevops/Provider/AzuredevopsProvider.cs and it has a namespace of azuredevops.Provider but when I try to do

using azuredevops.Provider

it can't find it. Does this have something to do with the.csproj file?

Any help in understanding how to include this would be appreciated.

You need to add a reference to your .csproj file, eg:

<ItemGroup>
    <ProjectReference Include=".gen\azuredevops\azuredevops.csproj" />
</ItemGroup>

See this example for reference.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM