参考包括不在存储库中的源

Reference Includes source that is not in the repository

我已经克隆了代码 for autorest.csharp 及其子模块 但是测试项目缺少依赖项

构建错误是

Error   CS0234  The type or namespace name 'Modeler' 
does not exist in the namespace 'AutoRest' 
(are you missing an assembly reference?)    autorest.csharp.test

但是解决方案文件包含以下内容

  <ItemGroup>
   <Reference Include="autorest.modeler">
      <HintPath>$(SolutionDir)\node_modules\@microsoft.azure\autorest.modeler\src\bin\netcoreapp2.0\autorest.modeler.dll</HintPath>
      <!-- <HintPath>C:\work\oneautorest\autorest.modeler\src\bin\netcoreapp2.0\autorest.modeler.dll</HintPath> -->
    </Reference>
    <ProjectReference Include="$(SolutionDir)src/autorest.csharp.csproj" />
  </ItemGroup>

如何包含缺少的依赖项的代码(或必要时包含 .dll)?

我可以看到建模器的源代码位于 this repository 但我应该如何访问它?

@microsoft.azure/autorest.modelerpackage.json devDependencies section.

中声明

That devDependencies部分描述为:

If someone is planning on downloading and using your module in their program, then they probably don't want or need to download and build the external test or documentation framework that you use.

In this case, it's best to map these additional items in a devDependencies object.

These things will be installed when doing npm link or npm install from the root of a package, and can be managed like any other npm configuration param.

所以在你的情况下,尝试:

NODE_ENV=development npm install

对于Windows:

cmd /v /c "set NODE_ENV=development&& npm install"

(不是 development&& 之间 space 的 缺少 :这很重要)

为了获取和安装开发依赖项以及主要生产项目。

或者,如“”中所述:

npm install --only=dev

同时检查 npm config production 值是否设置为 true。如果此值为真,它将跳过开发依赖项。

另外:运行 npm config get production,确保它设置为 false:

npm config set -g production false

如果 npm install --only=dev/npm rebuild 不起作用,您可能需要再次删除 node_modulespackage-lock.json 以及 运行 npm install