简体   繁体   English

AutoCAD 参考 Visual Studio 代码

[英]AutoCAD References Visual Studio Code

I'm currently trying to use c# to develop some programs to help automate AutoCAD, but I am not able to use Visual Studio due to not being able to afford Enterprise or Professional, and Community is giving me "Access not allowed" errors on any program I run.我目前正在尝试使用 c# 来开发一些程序来帮助自动执行 AutoCAD,但由于负担不起 Enterprise 或 Professional,我无法使用 Visual Studio,并且社区在任何情况下都给我“不允许访问”错误我运行的程序。 Thus, I am trying to use Visual Studio Code, but am having trouble getting the proper references in. I've tried using Nuget and installing all the Autodesk/AutoCAD search results, but none have worked.因此,我正在尝试使用 Visual Studio Code,但无法获取正确的引用。我尝试使用 Nuget 并安装所有 Autodesk/AutoCAD 搜索结果,但都没有奏效。 According to the .NET AutoCAD Developer's Guide, I need to reference .dll's called "AcMgd.dll", "AcDbMgd.dll", and "AcCoreMgd.dll" but they do not come up on the Nuget search.根据 .NET AutoCAD 开发人员指南,我需要引用名为“AcMgd.dll”、“AcDbMgd.dll”和“AcCoreMgd.dll”的 .dll,但它们不会出现在 Nuget 搜索中。 How can I get these properly set up so I can develop AutoCAD?如何正确设置这些以便我可以开发 AutoCAD? Is it possible, or will I need to find a way to use Visual Studio?是否可能,或者我需要找到一种使用 Visual Studio 的方法? Below are imports I am trying to use and corresponding errors.以下是我尝试使用的导入和相应的错误。

Thanks!谢谢!

试图使用的进口

相应的错误

Those files, AcMgd.dll, AcDbMgd.dll, and AcCoreMgd.dll will located in the directory that AutoCAD is installed to.这些文件 AcMgd.dll、AcDbMgd.dll 和 AcCoreMgd.dll 将位于安装 AutoCAD 的目录中。 They will have to be added as a reference normally, through the browse button, not through Nuget.它们通常必须作为参考添加,通过浏览按钮,而不是通过 Nuget。

I just noticed you said VS Code.我刚刚注意到你说的是 VS Code。 I do not know how you have the project setup or how to add references, but you have to reference those files specifically.我不知道您如何设置项目或如何添加引用,但您必须专门引用这些文件。

You should also make sure that when you add those as a reference that the "Copy Local" is set to false.您还应该确保在将它们添加为参考时将“本地复制”设置为 false。

you have to set it up in .csproj file.你必须在 .csproj 文件中设置它。

<Reference Include="AcMgd">
  <HintPath>C:\Program Files\Autodesk\AutoCAD xxxx\acmgd.dll</HintPath>
  <Private>False</Private>
</Reference>
<Reference Include="AcDbMgd">
  <HintPath>C:\Program Files\Autodesk\AutoCAD xxxx\AcDbMgd.dll</HintPath>
  <Private>False</Private>
</Reference>
<Reference Include="AcCoreMgd">
  <HintPath>C:\Program Files\Autodesk\AutoCAD xxxx\AcCoreMgd.dll</HintPath>
  <Private>False</Private>
</Reference>

General .csproj example you can find here: https://github.com/cake-build/example/blob/master/src/Example/Example.csproj您可以在此处找到一般 .csproj 示例: https : //github.com/cake-build/example/blob/master/src/Example/Example.csproj

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

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