asp.net mvc - How can a .NET 4.5.2 app still compile on a build server with only 4.5.1 installed? -
this has me baffled. testing upgrading our build infrastructure .net 4.5.2, on .net 4.5.1.
my first step create asp.net mvc project on developer machine targeting .net 4.5.2. using vs 2013 , have 4.5.2 developer pack installed. have written superfluous code utilizing methods supported in .net 4.5.2:
public actionresult index() { if (!response.headerswritten) response.addonsendingheaders((c) => { c.response.addheader("foo", "bar"); }); return view(); }
response.headerswritten
, response.addonsendingheaders
introduced in .net 4.5.2 version of system.web.dll
. expected, compiles fine locally.
prior upgrading build server 4.5.2 thought i'd run build of above project on build server source control see fail. build completes successfully, reporting following warning:
the reference assemblies framework ".netframework,version=v4.5.2" not found. resolve this, install sdk or targeting pack framework version or retarget application version of framework have sdk or targeting pack installed. note assemblies resolved global assembly cache (gac) , used in place of reference assemblies. therefore assembly may not correctly targeted framework intend.
i pull down compiled binaries drop local machine , app runs fine , adds foo
header.
how 4.5.2 code compile! there no local references system.web checked source being built , there nothing being pulled in through nuget package or such.
i've tracked down version of system.web.dll
in gac being referenced during build. despite documentation stating response.headerswritten
, response.addonsendingheaders
introduced in .net 4.5.2, following security update .net 4.5/4.5.1 installed version of system.web.dll gac include methods:
https://support.microsoft.com/en-us/kb/2894854
this explains why compilation still succeeds. when forcing build compile targeting 4.5.1, using /p:targetframeworkversion=v4.5.1
msbuild switch, system.web.dll
reference older version pulled following location, not include methods , therefore fails compile expected:
c:\program files (x86)\reference assemblies\microsoft\framework\.netframework\v4.5.1\system.web.dll
Comments
Post a Comment