Search code examples
autorest

Reference Includes source that is not in the repository


I have cloned the code for autorest.csharp and it's submodules However test project has a missing dependency

The build error is

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

However the solution file contains the following

  <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>

How do include the code ( or if necessary the .dll) for the missing dependency?

I can see the source for the modeler is at this repository but how should I be accessing it?


Solution

  • @microsoft.azure/autorest.modeler is declared in the package.json devDependencies section.

    That devDependencies section is described as:

    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.

    So in your case, try:

    NODE_ENV=development npm install
    

    For Windows:

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

    (not the lack of space between development and &&: that is important)

    In order to get and install development dependencies as well as the main production project.

    Or, as documented in "npm install won't install devDependencies":

    npm install --only=dev
    

    Also Check if npm config production value is set to true. If this value is true, it will skip over the dev dependencies.

    Also: Run npm config get production, make sure it is set to false:

    npm config set -g production false
    

    If npm install --only=dev/npm rebuild don't work, you might need to delete node_modules and package-lock.json and run npm install again