ASP.NET MVC project with a section written in Angular2: build error occurs when using MvcBuildViews

Well, that could be the only combination ...

Introduction

I have an existing ASP.NET MVC 5 project .
It contains the private area "admin" . I plan to change this area to port to Angular2 (+ WebAPI) :)

Due to some business requirements, I cannot change the architecture of the original Main website (splitting the Admin section to another site), so I have to place a new β€œAdmin” area written in Angular2 inside it.

Primary Website http://www.example.com
URL: Admin Area URL:http://www.example.com/admin

This is also true for the Visual Studio project :
I created the admin folder and put all of Angular2 in it .

Everything works perfectly...

NUMBER

My ASP.NET project uses the MvcBuildViews parameter to create MVC views in release mode .

Now, when I run the assembly in Release mode, I get this error:

\ node_modules \ selenium-webdriver \ lib \ test \ data \ web.config (29): error ASPCONFIG: error in using the partition registered as allowDefinition = 'MachineToApplication' outside the application level. This error can be caused by the fact that the virtual directory is not configured as applications in IIS.

The error makes no sense to me ...

MSBUILD web.config "node_modules". node_modules "npm install" ( Angular2).

msbuild... IMHO

... node_modules VS. MSBUILD , ...

  • MvcBuildViews... ,
  • node_modules. , . pre-build attrib +h "$(ProjectDir)node_modules"

?
googled...

+4
1

. :

node_modules ASP.NET

AspNetCompiler csproj aspnet_compiler.exe, . hardcoding .exe . .

$(FrameworkDir) $(FrameworkVersion), hardcoding , , aspnet_compiler.exe :

<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
    <Exec Command="$(FrameworkDir)\$(FrameworkVersion)\aspnet_compiler.exe -v temp -p $(WebProjectOutputDir) -x node_modules"/>
</Target>
0

Source: https://habr.com/ru/post/1673165/


All Articles