简体   繁体   中英

MSBuild compiling ASP.NET MVC4 application - designed using Visual Studio 2015

I am desperately looking out for a solution to my problem, my problem is with MSBuild continuous integration setup for my project which is designed using Visual Studio 2015.

Well I have not used all the new flavors out from VS 2015. Because my deployment server is configured with very old server OS ie Windows server 2003.

Hence the reason within VS 2015 I have designed my project to use .net framework 4.0 with ASP.NET MVC version 4 only. Which is only the version supported in Windows server 2003.

So, until the design time my application is compiling perfectly without throwing any reference error's.

When I am done writing MSBuild compilation setup and ran build using MSBuild.exe it is throwing below errors:

  1. CS0246: The type or namespace name 'HttpGet' could not be found (are you missing a using directive or an assembly reference?) [C:\\Workspaces\\myProject\\myProject.Web\\myProject.Web.csproj
  2. CS0246: The type or namespace name 'HttpGetAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:\\Workspaces\\myProject\\myProject.Web\\myProject.Web.csproj
  3. CS0246: The type or namespace name 'HttpGet' could not be found (are you missing a using directive or an assembly reference?) [C:\\Workspaces\\myProject\\myProject.Web\\myProject.Web.csproj
  4. CS0246: The type or namespace name 'HttpGetAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:\\Workspaces\\myProject\\myProject.Web\\myProject.Web.csproj
  5. CS0246: The type or namespace name 'HttpGet' could not be found (are you missing a using directive or an assembly reference?) [C:\\Workspaces\\myProject\\myProject.Web\\myProject.Web.csproj

Like these there are total 70 errors found while doing compilation using MSBuild command.

Please help me out how this issue can be fixed!

Thanks in advance

Vijay

The MVC 4 project is removed in VS 2015, but the tooling support for MVC 4 project is available in VS 2015 update 1 RC. More information, you can refer to this article.

So, you can create a MVC 4 project with .net framework 4.0 in VS 2013 and open it in VS 2015 update 1 RC or higher. It will throw many errors as yours if you change the .net framework to .net framework 4.0 of higher version of MVC project, for example, create MVC 4 project with .net framework 4.5 in VS 2015. I shared a MVC 4 project with default template here (created in VS 2013), that you could use in VS 2015.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM