This question is locked. New answers and comments are not allowed.
I'm using VS2010 and the latest telerik orm. I'm trying to target .net 4.0 with my project and am getting this error:
------ Rebuild All started: Project: DataModel, Configuration: Debug Any CPU ------
DataModel -> C:\dev\phoenix\Services\DataModel\bin\Debug\DataModel.dll
Telerik OpenAccess Enhancer, Version 2010.1.623.5
Copyright (C) 1996-2010 Telerik
The assembly is built by a runtime newer than the currently loaded runtime, and cannot be loaded.
1 Error(s) Verifying C:\dev\phoenix\Services\DataModel\bin\Debug\DataModel.dll
C:\dev\phoenix\Services\DataModel\enhance.targets(25,4): error MSB3073: The command "peverify.exe /nologo "C:\dev\phoenix\Services\DataModel\bin\Debug\DataModel.dll"" exited with code 1.
: skipped Services\DataModel\DataModel.csproj
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
========== OpenAccess All: 0 succeeded, 0 failed, 1 skipped ==========
If i target 3.5, no error.
If I run the same command peverify.exe /nologo "C:\dev\phoenix\Services\DataModel\bin\Debug\DataModel.dll from the VS2010 command prompt I get no error.
Please help!
Adam
------ Rebuild All started: Project: DataModel, Configuration: Debug Any CPU ------
DataModel -> C:\dev\phoenix\Services\DataModel\bin\Debug\DataModel.dll
Telerik OpenAccess Enhancer, Version 2010.1.623.5
Copyright (C) 1996-2010 Telerik
The assembly is built by a runtime newer than the currently loaded runtime, and cannot be loaded.
1 Error(s) Verifying C:\dev\phoenix\Services\DataModel\bin\Debug\DataModel.dll
C:\dev\phoenix\Services\DataModel\enhance.targets(25,4): error MSB3073: The command "peverify.exe /nologo "C:\dev\phoenix\Services\DataModel\bin\Debug\DataModel.dll"" exited with code 1.
: skipped Services\DataModel\DataModel.csproj
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
========== OpenAccess All: 0 succeeded, 0 failed, 1 skipped ==========
If i target 3.5, no error.
If I run the same command peverify.exe /nologo "C:\dev\phoenix\Services\DataModel\bin\Debug\DataModel.dll from the VS2010 command prompt I get no error.
Please help!
Adam
5 Answers, 1 is accepted
0
Hi Adam ,
are you using the enhancer task or the executable in your enhance.targets? If it is the excecutable to have to guide it to run in the .net 4.0 vm. Please create a venhance.exe.config and an enhancer.exe.config with this content:
Regards,
Jan Blessenohl
the Telerik team
are you using the enhancer task or the executable in your enhance.targets? If it is the excecutable to have to guide it to run in the .net 4.0 vm. Please create a venhance.exe.config and an enhancer.exe.config with this content:
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
startup
>
<!--The enhancer is compiled against .NET 2.0. -->
<!-- To be able to enhance an .NET 4.0 assembly please uncomment the next line:-->
<
supportedRuntime
version
=
"v4.0"
/>
</
startup
>
</
configuration
>
Regards,
Jan Blessenohl
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0

Adam
Top achievements
Rank 1
answered on 08 Jul 2010, 04:45 PM
Hi Jan,
Thankyou for the response. Unfortunately I already read the post regarding the solution you suggested above and made sure that those files were there before posting my question in the forum. My enhance.targets looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OpenAccessInstallDir>C:\Program Files (x86)\Telerik\OpenAccess ORM</OpenAccessInstallDir>
</PropertyGroup>
<Target Name="EnhanceAssembly" Condition="'$(_AssemblyTimestampBeforeCompile)'!='$(_AssemblyTimestampAfterCompile)'">
<Copy SourceFiles="$(TargetPath)" DestinationFiles ="$(TargetPath).notenhanced"/>
<Copy SourceFiles="$(PdbFile)" DestinationFiles ="$(PdbFile).notenhanced"/>
<Exec IgnoreExitCode="false"
WorkingDirectory="$(TargetDir)"
Command='"$(OpenAccessInstallDir)\sdk\venhance.exe" -verboseMode:2 -signAssembly "-keyFile:$(ProjectDir)$(AssemblyOriginatorKeyFile)" "-assembly:$(TargetPath)"'
Condition="'$(AssemblyOriginatorKeyFile)'!=''" />
<Exec IgnoreExitCode="false"
WorkingDirectory="$(TargetDir)"
Command='"$(OpenAccessInstallDir)\sdk\venhance.exe" -verboseMode:2 "-assembly:$(TargetPath)"'
Condition="'$(AssemblyOriginatorKeyFile)'==''" />
<Copy SourceFiles="$(TargetPath)" DestinationFolder ="$(IntermediateOutputPath)"/>
<Copy SourceFiles="$(PdbFile)" DestinationFolder ="$(IntermediateOutputPath)"/>
</Target>
<Target Name="PeVerify" Condition="'$(_AssemblyTimestampBeforeCompile)'!='$(_AssemblyTimestampAfterCompile)'">
<GetFrameworkSdkPath>
<Output TaskParameter="Path" PropertyName="SdkPath" />
</GetFrameworkSdkPath>
<Exec WorkingDirectory="$(SdkPath)bin" Command='peverify.exe /nologo "$(TargetPath)"' />
</Target>
<PropertyGroup>
<PdbFile>$(OutputPath)\$(AssemblyName).pdb</PdbFile>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
<PrepareForRunDependsOn>
$(PrepareForRunDependsOn);
EnhanceAssembly;
PeVerify
</PrepareForRunDependsOn>
</PropertyGroup>
</Project>
Any other ideas?
Adam
Thankyou for the response. Unfortunately I already read the post regarding the solution you suggested above and made sure that those files were there before posting my question in the forum. My enhance.targets looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OpenAccessInstallDir>C:\Program Files (x86)\Telerik\OpenAccess ORM</OpenAccessInstallDir>
</PropertyGroup>
<Target Name="EnhanceAssembly" Condition="'$(_AssemblyTimestampBeforeCompile)'!='$(_AssemblyTimestampAfterCompile)'">
<Copy SourceFiles="$(TargetPath)" DestinationFiles ="$(TargetPath).notenhanced"/>
<Copy SourceFiles="$(PdbFile)" DestinationFiles ="$(PdbFile).notenhanced"/>
<Exec IgnoreExitCode="false"
WorkingDirectory="$(TargetDir)"
Command='"$(OpenAccessInstallDir)\sdk\venhance.exe" -verboseMode:2 -signAssembly "-keyFile:$(ProjectDir)$(AssemblyOriginatorKeyFile)" "-assembly:$(TargetPath)"'
Condition="'$(AssemblyOriginatorKeyFile)'!=''" />
<Exec IgnoreExitCode="false"
WorkingDirectory="$(TargetDir)"
Command='"$(OpenAccessInstallDir)\sdk\venhance.exe" -verboseMode:2 "-assembly:$(TargetPath)"'
Condition="'$(AssemblyOriginatorKeyFile)'==''" />
<Copy SourceFiles="$(TargetPath)" DestinationFolder ="$(IntermediateOutputPath)"/>
<Copy SourceFiles="$(PdbFile)" DestinationFolder ="$(IntermediateOutputPath)"/>
</Target>
<Target Name="PeVerify" Condition="'$(_AssemblyTimestampBeforeCompile)'!='$(_AssemblyTimestampAfterCompile)'">
<GetFrameworkSdkPath>
<Output TaskParameter="Path" PropertyName="SdkPath" />
</GetFrameworkSdkPath>
<Exec WorkingDirectory="$(SdkPath)bin" Command='peverify.exe /nologo "$(TargetPath)"' />
</Target>
<PropertyGroup>
<PdbFile>$(OutputPath)\$(AssemblyName).pdb</PdbFile>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
<PrepareForRunDependsOn>
$(PrepareForRunDependsOn);
EnhanceAssembly;
PeVerify
</PrepareForRunDependsOn>
</PropertyGroup>
</Project>
Any other ideas?
Adam
0

Adam
Top achievements
Rank 1
answered on 08 Jul 2010, 04:50 PM
Looks like I get the same error running peverify from the command line:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin>PEVerify.exe \dev\phoeni
x\Services\DataModel\bin\Debug\DataModel.dll
Microsoft (R) .NET Framework PE Verifier. Version 3.5.30729.1
Copyright (c) Microsoft Corporation. All rights reserved.
The assembly is built by a runtime newer than the currently loaded runtime, and
cannot be loaded.
1 Error(s) Verifying \dev\phoenix\Services\DataModel\bin\Debug\DataModel.dll
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin>
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin>PEVerify.exe \dev\phoeni
x\Services\DataModel\bin\Debug\DataModel.dll
Microsoft (R) .NET Framework PE Verifier. Version 3.5.30729.1
Copyright (c) Microsoft Corporation. All rights reserved.
The assembly is built by a runtime newer than the currently loaded runtime, and
cannot be loaded.
1 Error(s) Verifying \dev\phoenix\Services\DataModel\bin\Debug\DataModel.dll
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin>
0

Adam
Top achievements
Rank 1
answered on 08 Jul 2010, 05:01 PM
It looks like there's another version of peverify in the NETFX 4.0 subfolder which works:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools>PEVerify
.exe \dev\phoenix\Services\DataModel\bin\Debug\DataModel.dll
Microsoft (R) .NET Framework PE Verifier. Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
All Classes and Methods in \dev\phoenix\Services\DataModel\bin\Debug\DataModel.d
ll Verified.
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools>
Which seems to indicate that the GetFrameworkSdkPath task in enhance.targets is returning the path to the 3.5 executable not the 4.0. I suppose one could hard code this, but then all of our dev and build machines would have to have the peverify executable in the same location which could be hard to enforce.
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools>PEVerify
.exe \dev\phoenix\Services\DataModel\bin\Debug\DataModel.dll
Microsoft (R) .NET Framework PE Verifier. Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
All Classes and Methods in \dev\phoenix\Services\DataModel\bin\Debug\DataModel.d
ll Verified.
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools>
Which seems to indicate that the GetFrameworkSdkPath task in enhance.targets is returning the path to the 3.5 executable not the 4.0. I suppose one could hard code this, but then all of our dev and build machines would have to have the peverify executable in the same location which could be hard to enforce.
0
Hi Adam ,
That was my next idea, are you sure the venhance.exe shows this error.
I am using:
Greetings,
Jan Blessenohl
the Telerik team
That was my next idea, are you sure the venhance.exe shows this error.
I am using:
<Exec WorkingDirectory="$(SdkPath)bin\NETFX 4.0 Tools" Command="peverify.exe /nologo "$(TargetPath)"" />
Greetings,
Jan Blessenohl
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items