» »

[c#] Vprašanje glede release verzije aplikacije

[c#] Vprašanje glede release verzije aplikacije

KernelPanic ::

Spoštovani!

V Visual Studio 2010 Ultimate imam Solution, v katerem imam dva projekta. Prvi je dll knjižnica, katere namene je komunikacija z napravo. Pod to knjnižnico je še en dll, katere namen je podpora industrijskemu modbus protokolu. Drugi projekt v Solution-u pa je grafična aplikacija, ki prikazuje status te naprave z uporabo omenjenih dll knjižnic. Sedaj pridemo do problema: modbus knjižnico, ki smo jo kupili je spisana in prevedena v .net framework 2.0, moj dll ter aplikacija pa sta spisani v framework 4.0. Na googlu sem našel, da je treba dopolnitii app.config datoteko obeh projektov z
<startup>
useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
in to sem tudi storil. Na development mašini v firmi zadeva deluje brez problemov. Ko smo šli pa na "release" mašino k stranki, sem na laptopu naredil finalni build solutiona, presnel vse potrebne datoteke na "release" mašino pri stranki in ko aplikacijo poženem, dobim sledeč error:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.FileLoadException: 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 information.
at AccuLoadIIICommDll.DeviceFunction..ctor(UInt16 iDeviceSlaveAddress)
at AccuLoadIIIMonitor.FormMain.FormMain_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.225 (RTMGDR.030319-2200)
CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
AccuLoadIIIMonitor
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Administrator/Desktop/AcculoadIIIMonitor/AccuLoadIIIMonitor.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
AccuLoadIIICommDll
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Administrator/Desktop/AcculoadIIIMonitor/AccuLoadIIICommDll.DLL
----------------------------------------
System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
Zakaj mi ne aplikacija ne dela na "release" mašini, mi lahko kdo pomaga? Release mašino sem tudi update-al, inštalirani so Windows XP Pro z vsemi nadgradnjami za .Net Framework 4.0. Programski jezik je c#.

Vnaprej se zahvaljujem za pomoč in s spoštovanjem,
M.

darkolord ::

Pa se ta atribut useLegacyV2RuntimeActivationPolicy dejansko nahaja tudi v končni različici config fajla (imeprograma.exe.config)?

AndrejS ::

Lahko nastaviš tvoj projekt na framework 2.0

nightrage ::

<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>


Tole dej v config, target framework dej v .NET Framework 4 in ne v .NET Framework 4 Client Profile, pa poiskus še platform target dat na x86.
Upam da bo delovalo.

KernelPanic ::

Hmm, hvala, to sem vse dodal, ampak ni delalo. Ko sem pa skopiral imeprograma.exe.config v "release" direktorij, je pa app zastartala, cudno ... Se ne da tega config fajla nekako "embeddati" v exe, ker imam notri connection string za bazo z vsemi "obcuteljivi" podatki (nekodiranimi) - username, pass, ....?

Ericssony ::

Ne moreš "ebedati" imeprograma.exe.config datoteke, ker se le-ta ustvari iz app.config, ko "zbildaš" program. Če bi to delovalno kako bi potem spreminjal uporabniške nastavitve?
Vse občutljive podatke pa lahko preprosto zakodiraš z recimo base64.

Zgodovina sprememb…



Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

Seštevanje, odštevanje za drugošolce

Oddelek: Šola
101700 (1356) norcuron
»

[c#] Vprasanje glede BackGroundWorker classa in spreminanja gui elementa

Oddelek: Programiranje
6784 (710) Ericssony
»

Tezava pri instanciranju class-a

Oddelek: Programiranje
61287 (1158) KernelPanic
»

null reference exception na čudnem mestu C#

Oddelek: Programiranje
51298 (1235) krho
»

Mono, je že kdo delal z njim?

Oddelek: Programiranje
171633 (1163) Beezgetz

Več podobnih tem