compilation issue

May 20, 2013 at 7:38 PM
I've recently added RazorGenerator to my project, and I'd like to add my thanks for adding this (imo) much needed feature to our environment. All our devs have installed the VSIX component, and we've included the RazorGenerator.Mvc dll in our project (via nuget). All is well so long as the devs are building.

But, once we hand off the source to our 'builder', we now get compiler errors:
ResolveAssemblyReferences:
  Unified primary reference "System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf385
6ad364e35, processorArchitecture=MSIL".
      Using this version instead of original version "3.0.0.0" in "C:\work\webstore\branches\ws_365\t
mpFlex_RenameMe\RevTrakPortal\packages\Glimpse.Mvc3.1.2.1\lib\net40\Glimpse.Mvc3.dll" because AutoUni
fy is 'true'.
      Using this version instead of original version "3.0.0.0" in "C:\work\webstore\branches\ws_365\t
mpFlex_RenameMe\RevTrakPortal\packages\RazorGenerator.Mvc.2.0.1\lib\net40\RazorGenerator.Mvc.dll" bec
ause AutoUnify is 'true'.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Coul
d not resolve this reference. Could not locate the assembly "System.Web.Mvc, Version=4.0.0.0, Culture
=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assemb
ly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\wo
rk\webstore\branches\ws_365\tmpFlex_RenameMe\RevTrakPortal\UnitTestLibrary\UnitTestLibrary.csproj]
          For SearchPath "C:\work\webstore\branches\ws_365\tmpFlex_RenameMe\RevTrakPortal\packages\Ra
zorGenerator.Mvc.2.0.1\lib\net40".
          Considered "C:\work\webstore\branches\ws_365\tmpFlex_RenameMe\RevTrakPortal\packages\RazorG
enerator.Mvc.2.0.1\lib\net40\System.Web.Mvc.dll", but it didn't exist.
          Considered "C:\work\webstore\branches\ws_365\tmpFlex_RenameMe\RevTrakPortal\packages\RazorG
enerator.Mvc.2.0.1\lib\net40\System.Web.Mvc.exe", but it didn't exist.
Thats just a short sample of the errors, but hopefully its enough to get things started.

What have I missed? I don't see anything in the documentation that suggests we should need to modify the main build script in any way.

FYI, the computer which performs the release build does not have VS installed on it at all, it does everything with msbuild. But, we don't want to be using a msbuild-task to perform the generation, we just want to compile what's already there.

Thanks!
Coordinator
May 20, 2013 at 7:48 PM
Are you using MVC3 or MVC4? Also, is this error happening at build time or runtime? Normally, assemblies are not loaded at build time.

Note that you seem to get an identical error from Glimpse, so it's probably not something directly related to RazorGenerator. Maybe you're just missing an Mvc binding redirect.
May 20, 2013 at 8:28 PM
MVC4, and the error happens at build time.

I'm leaning on it being a problem with the RazorGenerator, because thats the only substantial change I've made to the project since the last successful compile. We've had glimpse in the project for quite some time now.

The bit thats' sending me for a loop is "AutoUnify is 'true'" ... I'm not sure what that has to do with anything, and haven't had a chance to investigate that, but so far, its my best guess as a root issue.

The other matter of concern is that on the dev machines, when running the build script (as the release builder would do, from command, not from within VS), we first do a "coreClean", then "CoreCompile"....but on the builder environment, we first see "CoreClean" and then the failing "ResolveAssemblyReferences"... why does the compiler take different paths...I confess to not being conversant in compiler mechanics, so this seems like an interesting place to look for issues.

Thanks.
Coordinator
May 20, 2013 at 8:37 PM
In the end, there is not much magic about RazorGenerator.Mvc.dll. It's just s standard assembly that depends on Mvc 3 (like Glimpse). So when using Mvc 4, binding redirects are needed.

Not that your build error mentions not finding MVC4 at all, so maybe that's part of the problem.
Coordinator
May 20, 2013 at 8:48 PM
1) Could you try uninstalling the RazorGenerator.Mvc package and see if you are able to compile your project?
2) Can you see if you have the System.Web.Mvc listed in your web.config?
3) How is your project referencing the Mvc 4 binary (System.Web.Mvc)?
May 21, 2013 at 5:08 PM
Well, I've gotten a little deeper with this issue. It turns out that whats dying is my unit test library. If I comment that out of my csproj (post build event), and from my buildDeploy.cmd script, the actual application builds just fine with RazorGenerator.

I'll take a peek at the config for the unittest project, and report back.

One thing is particularly confusing to me still, though. if I have configuration issues, shouldn't it fail to build in my development environment also? I'm confused how it builds with identical configuration in one place, but fails on another one.

Also, because I'm not the person who does the builds, I have to schedule time with them to attempt another build, so the availability for that kind of thing is a bit spotty....(just to explain any delays)

Thanks again for your attention and suggestions.