x64 warning CS1607  
Author Message
Lio380





PostPosted: Visual C# General, x64 warning CS1607 Top

Hi,

I would like to build my assembly C# for the platforms x86 and x64. For that, I have the 32bits Framework in C:\WINDOWS\Microsoft.NET\Framework and the 64bits Framework  in C:\WINDOWS\Microsoft.NET\Framework64.

When I build my assembly for the platforms x86, it's OK. The .dll came from the 32bits Framework:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /unsafe- /checked- /nowarn:1701,1702 /nostdlib- /platform:x86 /errorreport:prompt /warn:4 /baseaddress:285212672 /define:DEBUG;TRACE /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug+ /debug:full /filealign:4096 /optimize- /out:obj\win32\Debug\ASCommun.dll /resource:obj\win32\Debug\ASCommun.AScComposant.resources /resource:obj\win32\Debug\ASCommun.AScComposantDispositif.resources /resource:obj\win32\Debug\ASCommun.AScComposantVirtuel.resources /resource:obj\win32\Debug\ASCommun.AScConnecteur.resources /resource:obj\win32\Debug\ASCommun.AScDlgCriteresRecherche.resources /resource:obj\win32\Debug\ASCommun.AScDlgSelPropCatalog.resources /resource:obj\win32\Debug\ASCommun.AScGroupBoxAccessoires.resources /resource:obj\win32\Debug\ASCommun.AScPanelComposants.resources /resource:obj\win32\Debug\ASCommun.AScPanelProprietes.resources /resource:obj\win32\Debug\ASCommun.AScProgressBar.resources /resource:obj\win32\Debug\ASCommun.AScTabCatalog.resources /resource:obj\win32\Debug\ASCommun.TreeViewEx.resources /target:library /warnaserror- API.cs AScAccesBD.cs AScAccesLocale.cs AScBaseCompoGrpCts.cs AScCBoxItem.cs AScComposant.cs AScComposantDispositif.cs AScComposantVirtuel.cs AScConnecteur.cs AScConteneurPropriete.cs AScDefComProp.cs AScDefinitions.cs AScDlgCriteresRecherche.cs AScDlgSelPropCatalog.cs AScEnumList.cs AScEnumListPN.cs AScEnvironnement.cs AScEvenement.cs AScFactory.cs AScGestionPropAction.cs AScGroupBoxAccessoires.cs AScInterfaceCatalogNet.cs AScInterfaceXML.cs AScMatrice2D.cs AScNoeud.cs AScPanelComposants.cs AScPanelProprietes.cs AScProgressBar.cs AScPropriete.cs AScPropTreeNode.cs AScTabCatalog.cs AScTabIdentification.cs AScUnites.cs ASiAccesBD.cs ASiCBoxItem.cs ASiComposant.cs ASiConnecteur.cs ASiConteneurPropriete.cs ASiEvenement.cs ASiFactory.cs ASiInterfaceXML.cs ASiNoeud.cs ASiProgressBar.cs ASiPropriete.cs ASiUnite.cs AssemblyInfo.cs GenericEventArgs.cs InterfaceCatalog.cs NomTypePropriete.cs PanelExt.cs PointRepere.cs TreeViewEx.cs

When I build my assembly for the platforms x64, the .dll came from the 32bits Framework too:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /nowarn:1701,1702 /platform:x64 /errorreport:prompt /baseaddress:285212672 /define:DEBUG;TRACE /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug+ /debug:full /out:obj\x64\Debug\ASCommun.dll /resource:obj\x64\Debug\ASCommun.AScComposant.resources /resource:obj\x64\Debug\ASCommun.AScComposantDispositif.resources /resource:obj\x64\Debug\ASCommun.AScComposantVirtuel.resources /resource:obj\x64\Debug\ASCommun.AScConnecteur.resources /resource:obj\x64\Debug\ASCommun.AScDlgCriteresRecherche.resources /resource:obj\x64\Debug\ASCommun.AScDlgSelPropCatalog.resources /resource:obj\x64\Debug\ASCommun.AScGroupBoxAccessoires.resources /resource:obj\x64\Debug\ASCommun.AScPanelComposants.resources /resource:obj\x64\Debug\ASCommun.AScPanelProprietes.resources /resource:obj\x64\Debug\ASCommun.AScProgressBar.resources /resource:obj\x64\Debug\ASCommun.AScTabCatalog.resources /resource:obj\x64\Debug\ASCommun.TreeViewEx.resources /target:library API.cs AScAccesBD.cs AScAccesLocale.cs AScBaseCompoGrpCts.cs AScCBoxItem.cs AScComposant.cs AScComposantDispositif.cs AScComposantVirtuel.cs AScConnecteur.cs AScConteneurPropriete.cs AScDefComProp.cs AScDefinitions.cs AScDlgCriteresRecherche.cs AScDlgSelPropCatalog.cs AScEnumList.cs AScEnumListPN.cs AScEnvironnement.cs AScEvenement.cs AScFactory.cs AScGestionPropAction.cs AScGroupBoxAccessoires.cs AScInterfaceCatalogNet.cs AScInterfaceXML.cs AScMatrice2D.cs AScNoeud.cs AScPanelComposants.cs AScPanelProprietes.cs AScProgressBar.cs AScPropriete.cs AScPropTreeNode.cs AScTabCatalog.cs AScTabIdentification.cs AScUnites.cs ASiAccesBD.cs ASiCBoxItem.cs ASiComposant.cs ASiConnecteur.cs ASiConteneurPropriete.cs ASiEvenement.cs ASiFactory.cs ASiInterfaceXML.cs ASiNoeud.cs ASiProgressBar.cs ASiPropriete.cs ASiUnite.cs AssemblyInfo.cs GenericEventArgs.cs InterfaceCatalog.cs NomTypePropriete.cs PanelExt.cs PointRepere.cs TreeViewEx.cs

And there are some warnings CS1607:

warning CS1607: Assembly generation -- Referenced assembly 'System.Data.dll' targets a different processor

warning CS1607: Assembly generation -- Referenced assembly 'mscorlib.dll' targets a different processor

How then I, in the .csproj, to indicate where to find the rights .dll I tried with the property "HintPath". But I can't do that with the "mscorlib.dll" and this property is only available in the "ItemGroup" and not in the "PropertyGroup"!

<ItemGroup>

<Reference Include="System">

<Name>System</Name>

<HintPath>C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\System.dll</HintPath>

</Reference>

...

</ItemGroup>

Thanks in advance



Visual C#1  
 
 
Lio380





PostPosted: Visual C# General, x64 warning CS1607 Top

Hi,

May be, I have to change context of the environment in the pre-build or in de .csproj like vsvars32.bat or sdkvars.bat to indicate the good csc.exe.

But, I don't know how!

Any idea

Thanks


 
 
Myron Brown





PostPosted: Visual C# General, x64 warning CS1607 Top

I'm having the exact same problem and was surprised to see that this is the only post about it so far. If you figure it out, please let me know, and I'll do the same.

Myron


 
 
Chuck the Code Monkey





PostPosted: Visual C# General, x64 warning CS1607 Top

http://technet.microsoft.com/en-us/library/4a0640cd.aspx

This happens most any time you build x64 assemblies as the compiler is trying to reference the 32-bit assemblies. This issue is resolved at tun time though since the 64-bit runtime will automatically load the 64-bit dlls instead of the referenced 32-bit dlls. It's nothing to wory about and is just one of those "Visual Studio'isms" that you have to deal with when building 64-bit code. As a developer of 64-bit machine vision software in .NET for the past few years, myself and the other developers here get that error in EVERY 64-bit C# build and it has never caused a problem as the runtime takes care of it.


 
 
Myron Brown





PostPosted: Visual C# General, x64 warning CS1607 Top

Chuck,

Thanks for the advice. The warning was a red herring. I'm still seeing problems with the window refreshes.

I started with a 32-bit C# .NET 2.0 app that calls a 32-bit C++ DLL (both built with Visual Studio 2005), then built both for 64 bits and ran on my Windows XP64 machine. The DLL code functions properly. The C# front-end works, but the window doesn't refresh properly. Some of the controls look corrupted, and the refresh is slow when the form is exposed both for the first time and after being hidden by another window. The hourglass cursor also doesn't always display when it should.

To simplify things, I built a simple C# .NET 2.0 app that displays a form with some controls like DataGridViews and NumericUpDowns, much like my other app except that it doesn't have any callbacks. I get the same behavior from this app, with the slow refresh and still having corrupted looking controls. It seems like adding more controls to the form makes the problem more noticable too.

Grasping at straws, I upgraded XP64, .NET 2.0 and Visual Studio 2005 with the latest service packs and updates. No luck. Also tried this on another XP64 machine with the same results. Also built the app on multiple 32-bit and 64-bit machines with the same results.

Any ideas

Myron