ASP. NET Mvc4 when you set up the build project, compile the view page

Source: Internet
Author: User

After creating a new project, remove System.web.mvc.dll and re-select local C:\Program Files (x86) \microsoft Asp.net\asp.net MVC 4\ Assemblies under the System.web.mvc.dll, compile a problem prompt: "The type or namespace name ' Html ' does not exist in the namespace ' SYSTEM.WEB.MVC ‘”

Switch back the problem still occurs with the System.web.mvc.dll under the new application directory.

To have the view recompile:

1,) modify the Web solution. csproj file,

1.1,) Set the Mvcbuildviews property to True;

< mvcbuildviews >true</mvcbuildviews>

1.2,) Add the following to the </Project> front:

1     <!--to modify your build process, add your task inside one of the targets below and uncomment it.2 Other similar extension points exist, see Microsoft.Common.targets.3 <target name= "BeforeBuild" >4 </Target>5 <target name= "Afterbuild" >6 </Target> -7   <TargetName= "Mvcbuildviews"aftertargets= "Afterbuild"Condition= "' $ (mvcbuildviews) ' = = ' true '">8     <AspNetCompilervirtualpath= "Temp"PhysicalPath= "$ (webprojectoutputdir)" />9   </Target>Ten </Project>

, and then recompile, the problem is solved.

ASP. NET Mvc4 when you set up the build project, compile the view page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.