ASP.NET compiler does not work with XmlSerializers error during web deployment project

We use Visual Studio 2010 web application deployment projects to compile web applications during our build. Visual Studio 2010 is not installed on our collectors. We get an error (see below) during the build associated with the automatically generated Foo.XmlSerializers.dll file, which is created with an earlier version than the currently loaded runtime, and aspnet_compiler.exe cannot be loaded.

We focus on the .NET Framework v3.5 in our project files.

Here's the error (reformatted for long lines):

"C:\BuildAgent\work\3836706d661b8a05\project\src\Foo.FrontEnd.WdpSite\ Foo.FrontEnd.WdpSite.wdproj" (Build target) (1) -> (AspNetCompiler target) -> ASPNETCOMPILER : error ASPCONFIG: Could not load file or assembly 'Foo.FrontEnd.Site.XmlSerializers' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. [C:\BuildAgent\work\3836706d661b8a05\project\src\Foo.FrontEnd.WdpSite\ Foo.FrontEnd.WdpSite.wdproj] 
+4
source share
1 answer

I had a similar problem with the same error message, and after many disappointments a solution was found (which, I hope, will give some ideas for this).

Here we have a build server with Windows SDK 7.1 (and with 6.1 when using Vs 2008), creating VS 2010 projects targeting .NET 3.5. Web projects are then precompiled using aspnet_compiler (from v2 at http://msdn.microsoft.com/en-us/library/ms229863.aspx#findingthecorrectversion ). During the pre-compilation, I received the same error message as you, for a project (not a web, just a regular library) with a web link to a web service. It appears that the Windows SDK 7.1 incorrectly configured the registry paths to use the .NET 3.5 tools (while Visual Studio does this). This led to the fact that the web links were compiled with the target .NET 4 environment (using a reflector), so aspnet_compiler v2 had a fit. I compared the build server registry settings with my local visual studio, which showed that the .NET 3.5 configuration for SDK 7.1 was not good, so I fixed the build server with the following. I assume that the xml web link (in a non-web project) was precompiled with sgen for .NET 4 as a rollback for misusing .NET 3.5 sgen. As soon as the registry change was applied, everything was in order (the assembly server was not in my registry below, so I created it).

 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDK-NetFx35Tools-x86] "ComponentName"="Windows SDK .NET Framework 3.5 Multi-targeting Utilities" "InstallationFolder"="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\bin\\" "ProductVersion"="7.1.7600.0.30514" 

As an additional note, I also used WindowsSdkVer to install 7.1 as the default SDK.

+1
source

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


All Articles