Search code examples
angularasp.net-corecsproj

Visual Studio Code .NET Core .csproj exclude


I have a .NET Core project using Visual Studio Code looks like

Angular2CLIApp
wwwroot
myproject.csproj

The Angular 2 CLI app has a depenedency on the selenium-webdriver which once installed places a Page.aspx.cs (+ some) file into the node_modules folder in the Angular2CLIApp folder - this is causing the myproject.csproj build to fail

I am trying to exclude the Angular2CLIApp folder from the build using item groups in the .csproj

<ItemGroup>
    <None Include="Angular2CLIApp/" />
</ItemGroup>

I have found I can resolve this a bit by changing the project structure to something like

SPAs
    Angular2CLIApp
DOTNET
   wwwroot
   myproject.csproj

But this is not really ideal


Solution

  • Finally, after much trial and error, this seems to work

    <PropertyGroup>
      ...
      <DefaultItemExcludes>
        $(DefaultItemExcludes);Angular2CLIApp/**;
      </DefaultItemExcludes>
    </PropertyGroup>