0

I have a xaml file looking like this.

<Window x:Class="Space4it.Energilab.DataApplicationWPF.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:local="clr-namespace:Space4it.Energilab.DataApplicationWPF"
    Title="Space4it NetBitter database interface" Height="700" Width="1200" 
    x:Name="rootElement"
    Icon="program.ico">


<Window.DataContext>
<local:MainWindowDataModel/></Window.DataContext>

The MainWindowDataModel are located in the main WPF project and it works in "Debug - X86". But when changing to "Production - X64" I get this error:

Error 1 The name "MainWindowDataModel" does not exist in the namespace "clr-namespace:Space4it.Energilab.DataApplicationWPF". C:\Users\tarp\Dropbox\Space4it\Development\Energilab\Development\Space4it.Energilab.Solution\Space4it.Energilab.DataApplicationWPF\MainWindow.xaml 10 5 Space4it.Energilab.DataApplicationWPF

I did "Clean", recompile ....

Funny thing is that the DataGrid fetches data, but this ComboBox inside grid does not! This is only a problem when installing program om other computer. I.e. Windows Server 2008.

<DataGridComboBoxColumn Header="Key" SelectedValueBinding="{Binding Path=t_keys_id, UpdateSourceTrigger=PropertyChanged}">
                <DataGridComboBoxColumn.ElementStyle>
                  <Style TargetType="ComboBox">
                    <Setter Property="ItemsSource" Value="{Binding ElementName=rootElement, Path=DataContext.keyData}"/>
                    <Setter Property="IsEditable" Value="False"/>
                    <Setter Property="DisplayMemberPath" Value="nb_key" />
                    <Setter Property="SelectedValuePath" Value="id"/>
                  </Style>
                </DataGridComboBoxColumn.ElementStyle>
                <DataGridComboBoxColumn.EditingElementStyle>
                  <Style TargetType="ComboBox">
                    <Setter Property="ItemsSource" Value="{Binding ElementName=rootElement, Path=DataContext.keyData}"/>
                    <Setter Property="IsEditable" Value="True"/>
                    <Setter Property="DisplayMemberPath" Value="nb_key" />
                    <Setter Property="SelectedValuePath" Value="id"/>
                  </Style>
                </DataGridComboBoxColumn.EditingElementStyle>
              </DataGridComboBoxColumn>

Does anyone have any ideas?

Nerds Rule
  • 35
  • 1
  • 8
  • try adding `";assemblyname=Space4it.Energilab.DataApplicationWPF"` (the assembly of the referenced project) into the local definition. – Kevin DiTraglia Aug 22 '12 at 16:43
  • Does not work. Space4it.Energilab.DataApplicationWPF is a .exe file. Not sure if that could be a problem. All the WPF code are in the same .exe file. – Nerds Rule Aug 23 '12 at 10:57

1 Answers1

1

At a guess, I'd say that the Space4it.Energilab.DataApplicationWPF assembly had been compiled with the "x86" platform, instead of "AnyCPU" or "x64"...so when you switch the configuration it can't access a 64bit version of that assembly.

If it's a 3rd party library whose source you don't have then you might be able to hack it with CorFlags to allow it to be JITted as 64bit (by clearing the 32bit flag).

If you do have the source, then you can build it so it can be used in 64bit mode take a look at the Configuration Manager in your Solution, and check which Platform configuration is used for the project in "Production - x64"

Community
  • 1
  • 1
Colin Smith
  • 12,375
  • 4
  • 39
  • 47
  • Yeah, I would agree that one or more projects in the solution are not being built due to what you described. – code4life Aug 22 '12 at 18:45
  • Thanks for the ansvars. All code as my own and all are set to X64. The MainWindowDataModel.cs are located in the .exe file/same project. Did the assembly test and got ILOnly, PEP32lus back. If I copy the AnyCPU compiled version that works to the 2008 Server no data are fetched and it seams that MainWindowDataModel are never called? – Nerds Rule Aug 23 '12 at 10:06
  • Do you use any [DllImport] anywhere to call any WIN32 API calls? If so, then you need to update them to 64bit declarations. That's because you aren't allowed to directly call 32bit API entries from 64bit code. – Colin Smith Aug 23 '12 at 10:14
  • I have no DllImport. Pure WPF and SQL Server/LINQ stuff. If I use InstallShield Express to deploy it takes Microsoft.csharp.dll and System.Dynamics.dll and System.Xaml.dll into the install file. Seams strange? – Nerds Rule Aug 23 '12 at 10:51
  • If you manually deploy the application does it work, it might be InstallShield which is using the wrong files ? – Colin Smith Aug 23 '12 at 13:30
  • No. Did a copy from the bin dir. to the server with the same result. – Nerds Rule Aug 23 '12 at 13:35
  • Switch on Fusion Logging with FusLogVW.exe...run your application as 64bit on your dev machine...and then run it on Server 2008....and compare the 2 logs....see what the difference is....paste the logs up here if you can. – Colin Smith Aug 23 '12 at 13:40
  • Sorry...here's the link to fusion log.....http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.71).aspx – Colin Smith Aug 23 '12 at 13:57
  • Thanks! I had to develop a plan B solution due to deadline. But I'll still try to find the problem. I'll be back :-) – Nerds Rule Aug 26 '12 at 09:02
  • Could not install fuslogvw on the server. Had to go with plan b. Thanks anyway! – Nerds Rule Aug 26 '12 at 18:12