Sdk: dotnet build fails - attempts to build *.aspx file in node_modules package

Created on 13 Apr 2016  路  4Comments  路  Source: dotnet/sdk

Steps to reproduce

dotnet new
npm init 
npm install protractor --saveDev
dotnet build

Expected behavior

no errors

Actual behavior

<projectname>/node_modules/protractor/node_modules/selenium-webdriver/lib/test/data/Page.aspx.cs(4,36): error CS0234: The type or namespace name 'Web' does not exist in the namespace 'System' (are you missing an assembly reference?)

Environment data

dotnet --info
.NET Command Line Tools (1.0.0-beta-002202)

Product Information:
 Version:     1.0.0-beta-002202
 Commit Sha:  60b23d5115

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.11
 OS Platform: Darwin
 RID:         osx.10.11-x64

Most helpful comment

compileExclude is deprecated now, use "compile": { "exclude": "node_modules/" } in buildOptions

All 4 comments

set the compileExclude in project.json

"compileExclude": "node_modules"

compileExclude is deprecated now, use "compile": { "exclude": "node_modules/" } in buildOptions

I just tried this in preview3 with csproj and it worked quite nicely :) Here is the csproj I used, for reference. Notice the <Compile ... Exclude="..."/> tag.

<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp1.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="**\*.cs"
             Exclude="node_modules/selenium-webdriver/**/*.cs" />
    <EmbeddedResource Include="**\*.resx" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NETCore.App">
      <Version>1.0.1</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.NET.Sdk">
      <Version>1.0.0-alpha-20161104-2</Version>
      <PrivateAssets>All</PrivateAssets>
    </PackageReference>
  </ItemGroup>

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

I found the problem and the solution. I had angular2 cli project in this folder
i have excluded that folder and now build works.

  "compile": {
      "exclude": ["angular2cli-project"]
    }
Was this page helpful?
0 / 5 - 0 ratings