5

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?

jthill
  • 55,082
  • 5
  • 77
  • 137
Kirsten
  • 15,730
  • 41
  • 179
  • 318

1 Answers1

3

@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

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I have npm installed byt I get NODE_ENV is not recognized as an internal or external command, operable program or batch file – Kirsten Jun 02 '18 at 05:53
  • Yes, On Windows, the synax would be different. Does `npm install --only=dev` at least allow you to get those dev dependencies? – VonC Jun 02 '18 at 05:55
  • Yes, running it now – Kirsten Jun 02 '18 at 05:56
  • 1
    @KirstenGreed I have edited the answer to add the Windows syntax for `NODE_ENV`. – VonC Jun 02 '18 at 05:57
  • I get the following error post this `Predefined type 'System.Void' is not defined or imported autorest.csharp.test`. Any takers? – Raj Kumar Apr 11 '19 at 04:09
  • @RajKumar Maybe try and restore NuGet packages, as in https://github.com/Microsoft/react-native-windows/issues/1593#issuecomment-360215034 – VonC Apr 11 '19 at 06:26
  • So the problem was Resharper doing something that wasn't expected. I disabled resharper and things seemed to kick in – Raj Kumar Apr 12 '19 at 03:31