Failed to create .Net MVC project in TeamCity

I am trying to set up a build for a .Net MVC project in TeamCity. I followed the steps outlined here: How to Create ASPNET Applications in TeamCity

But the build still doesn't work. The error messages I have are

App_Start\BundleConfig.cs(2, 18): error CS0234: The type or namespace name 'Optimization' does 

not exist in the namespace 'System.Web' (are you missing an assembly reference?) 
App_Start\FilterConfig.cs(2, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 
App_Start\RouteConfig.cs(5, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 
Controllers\HomeController.cs(5, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 
Controllers\HomeController.cs(9, 35): error CS0246: The type or namespace name 'Controller' could not be found (are you missing a using directive or an assembly reference?) 
Global.asax.cs(5, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 
Global.asax.cs(6, 18): error CS0234: The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 
App_Start\BundleConfig.cs(9, 44): error CS0246: The type or namespace name 'BundleCollection' could not be found (are you missing a using directive or an assembly reference?) 
App_Start\FilterConfig.cs(8, 50): error CS0246: The type or namespace name 'GlobalFilterCollection' could not be found (are you missing a using directive or an assembly reference?) 
Controllers\HomeController.cs(11, 16): error CS0246: The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?) 
Controllers\HomeController.cs(16, 16): error CS0246: The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?) 
Controllers\HomeController.cs(23, 16): error CS0246: The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?) 

      

I have all links with Copy Local = true and True in csproj. TeamCity downloads the nuget packages correctly but doesn't seem to be using them. All I can see is that the .csprojResolveAssemblyReference file in obj / Release has the following line:

C: \ Program Files (x86) \ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5.1 \ System.Web.dll

So it looks like this file is in use and not a file in the nuget folder.

What do I need to do to get it up and running?

Many thanks.

+3


source to share


3 answers


I finally solved the problem. What I did was to download NuGet packages to the source repository and remove the NuGet step in the TeamCity config. In fact, I prefer this setting to work in my code, although NuGet does not.



Many thanks.

-2


source


You need to add a step to the build process to restore all NuGet packages. See here for details .



+2


source


The System.Web.Optimization namespace is missing from the System.Web.dll assembly. He got his own assembly System.Web.Optimization.dll. Add this DLL as a reference. If you don't have this DLL, get it via NuGet. I think this is the right package.

0


source







All Articles