首页 新闻 会员 周边 捐助

SQLite部署问题

0
悬赏园豆:10 [已解决问题] 解决于 2011-09-23 13:39

引用的SQLite.Net的程序集:

System.Data.SQLite.dll System.Data.SQLite.Linq.dll

本地VS编译成功,服务器batchbuil错误,batch代码在下面。

错误信息:

SGEN : error : Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration

batch code:

ECHO OFF
SET config=%1
IF "%config%" == "" (
set config=release
)
ECHO.Lauch build %config% ...
SET framework=Framework64
IF %PROCESSOR_ARCHITECTURE% == x86 SET framework=Framework
%WINDIR%\Microsoft.NET\%framework%\v4.0.30319\msbuild BuildWebSite.xml
pause

配置文件:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<OutDir>bin\</OutDir>
<Configuration>release</Configuration>
</PropertyGroup>
<Target Name="Build">
<ItemGroup>
<BuildProject Include="*.web/*.csproj"/>
</ItemGroup>
<MSBuild Projects="@(BuildProject)"
Properties
="Configuration=$(Configuration);DebugSymbols=false;DebugType=none;
AllowedReferenceRelatedFileExtensions=false"
>
<Output TaskParameter="TargetOutputs" ItemName="MsBuildResult"/>
</MSBuild>
<ItemGroup>
<FileCopies Include="**\bin\$(Configuration)\*.dll"/>
</ItemGroup>
<PropertyGroup>
<RelativeOutDir>@(BuildProject->'%(RelativeDir)$(OutDir)')</RelativeOutDir>
<FullOutDir>@(BuildProject->'%(RootDir)%(Directory)$(OutDir)')</FullOutDir>
</PropertyGroup>
<Copy
SourceFiles="@(FileCopies)"
DestinationFolder
="$(RelativeOutDir)"
SkipUnchangedFiles
="true"
OverwriteReadOnlyFiles
="true"
Retries
="2"
RetryDelayMilliseconds
="10"
UseHardlinksIfPossible
="false"
Condition
="!Exists('$(FullOutDir)%(Filename)%(Extension)')"
>
<Output TaskParameter="DestinationFiles" ItemName="CopyResult"/>
</Copy>
<Message Text="Show Result: @(CopyResult)"/>
</Target>
</Project>

可能原因:

System.Data.SQLite.dll里面混杂了x86和x64的sqlite c代码,但是我替换了两个程序集还是这个错误。

问题补充:

在类库中间接引用规避web引用的错误后在本地出现如下错误

Could not load file or assembly 'CNBlogs.Job.Web' or one of its dependencies. An attempt was made to load a program with an incorrect format.

today4king的主页 today4king | 老鸟四级 | 园豆:3499
提问于:2011-09-21 20:21
< >
分享
最佳答案
0

试试这里的方法,在web.config中加上如下的配置:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
收获园豆:10
dudu | 高人七级 |园豆:30257 | 2011-09-21 20:37

还是一样的错误~!

today4king | 园豆:3499 (老鸟四级) | 2011-09-21 23:04

我想在xxx.dll.config和xxx.exe.config和app.config都应该有效,但是没有搜到web.config中成功的人。刚刚用类库间接引用规避了这个错误,但是希望知道在web中怎么配置。

today4king | 园豆:3499 (老鸟四级) | 2011-09-21 23:34

@今朝-TODAY:stackoverflow上遇到的同样的问题:What 'additional configuration' is necessary to reference a .NET 2.0 mixed mode assembly in a .NET 4.0 project?

Mixed mode assembly指的是C++/CLI assembly。

 

dudu | 园豆:30257 (高人七级) | 2011-09-22 10:48
其他回答(1)
0

<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v2.0.50727"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>

夜の魔王 | 园豆:441 (菜鸟二级) | 2013-03-13 18:04
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册