简体   繁体   English

CDKTF C# 如何包含没有预建提供程序的提供程序 - 名称空间混淆

[英]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?我是 C# 的新手,我已经能够使用 CDKTF 和 Azure 的预构建提供程序为客户端构建应用程序。我的问题是,如果没有预构建的提供程序,我如何将绑定包含在我的代码? I see that with typescript it's as simple as import { YourProvider } from './gen/providers/<yourprovider>/provider';我看到 typescript 就像import { YourProvider } from './gen/providers/<yourprovider>/provider'; (referenced from here ). (从这里引用)。

The problem is that in C#, it's not so straightforward it seems.问题是在 C# 中,它看起来并不那么简单。 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)我也尝试过 ChatGPT,但它的解释并不重要(暗示问题是我缺乏理解/正确的词汇)

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我看到提供者存在于.gen/azuredevops/azuredevops/Provider/AzuredevopsProvider.cs并且它有一个azuredevops.Provider的命名空间但是当我尝试做

using azuredevops.Provider

it can't find it.它找不到它。 Does this have something to do with the.csproj file?这与 .csproj 文件有关吗?

Any help in understanding how to include this would be appreciated.任何有助于理解如何包括这一点的帮助将不胜感激。

You need to add a reference to your .csproj file, eg:您需要添加对.csproj文件的引用,例如:

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

See this example for reference.请参阅此示例以供参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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