RSS

Found conflicts between different versions of the same dependent assembly

warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.

First of all Change build log verbosity to detailed. This is done by changing the value for Tools>Options>Project and Solutions>Build and Run>MSBuild project outbut verbosity to detailed.

After that you can rebuild the solution. During build time MSBuild writes a lot of information to the Output-View. After build completition you have to search the whole log file for the corresponding assembly conflict. You can do this by using CTRL+F to open the search-view, entering “conflict” and hitting the search button. Visual Studio highlights all corresponding matches. Search for a message that states a sentence like the following:

There was a conflict between “System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ and “System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″.
“System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ was chosen because it was primary and “System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ was not.

Just remove the reference to the wrong assembly from the current built project System.Windows.Interactivity, Version=4.0.0.0 and add the reference to the correct assembly System.Windows.Interactivity, Version=4.5.0.0 and the warning is gone when you build the Project the next time.

After that you are free to change the build verbosity back to the previous value.

 
Leave a comment

Posted by on November 10, 2014 in C-Sharp

 

Tags: ,

Thank you all for the 100.000th view.

 
Leave a comment

Posted by on November 4, 2014 in Uncategorized

 

WMI Filter for laptops

For filtering laptops in a WMI query there are several different approaches to find out if a system is a laptop or not. A suggested way found on the internet is following WMI query

SELECT * FROM Win32_Battery WHERE (BatteryStatus <> 0)

This works, but if you remove the battery from your laptop and keep the lLaptop on the power chord only this will not work. Then the laptop seems to be a desktop machine. A better approach is to use the following WMI-query:

SELECT * FROM Win32_ComputerSystem WHERE PCSystemType = "2";
 
Leave a comment

Posted by on September 29, 2014 in Windows Server

 

Tags: ,

Inlines and Run in TextBlock does not follow Language override

If you want to localize your application you generally override the LanguageProperty with your desired language:

FrameworkElement.LanguageProperty.OverrideMetadata(
    typeof(FrameworkElement), 
    new FrameworkPropertyMetadata(XmlLanguage.GetLanguage("de-DE")));

As stated in the documentation every control should now use the – in this case – German culture. Well this is not the case. If you have a TextBlock and set the Text property then this works, but if you have a TextBlock with Inline elements, then the en-us culture is used.
This is very stange. Why is that the case? TextBlock inherits from FrameworkElement and because you have overridden the FrameworkElement.LanguageProperty this works. But if you use Inlines, such as Run, Italic, Underline, … those controls inherits from FrameworkContentElement and not from FrameworkElement for which you do not have overridden the corresponding DependencyProperty. This is the only reason why Inlines do not follow the application wide culture. As solution for that you have to override the LanguageProperty for FrameworkContentElements.

FrameworkContentElement.LanguageProperty.OverrideMetadata(
    typeof(FrameworkElement),
    new FrameworkPropertyMetadata(XmlLanguage.GetLanguage("de-DE")))

This does not work because it says that is is already registered. So a workaround is to override if for every class that is one inheritance hierarchy lower than FrameworkContentElement:

 FrameworkContentElement.LanguageProperty.OverrideMetadata(
    typeof(DefinitionBase),
    new FrameworkPropertyMetadata(XmlLanguage.GetLanguage("de-DE")));

            FrameworkContentElement.LanguageProperty.OverrideMetadata(
    typeof(FixedDocument),
    new FrameworkPropertyMetadata(XmlLanguage.GetLanguage("de-DE")));

            FrameworkContentElement.LanguageProperty.OverrideMetadata(
    typeof(FixedDocumentSequence),
    new FrameworkPropertyMetadata(XmlLanguage.GetLanguage("de-DE")));

            FrameworkContentElement.LanguageProperty.OverrideMetadata(
    typeof(FlowDocument),
    new FrameworkPropertyMetadata(XmlLanguage.GetLanguage("de-DE")));

            FrameworkContentElement.LanguageProperty.OverrideMetadata(
    typeof(TableColumn),
    new FrameworkPropertyMetadata(XmlLanguage.GetLanguage("de-DE")));

            FrameworkContentElement.LanguageProperty.OverrideMetadata(
    typeof(TextElement),
    new FrameworkPropertyMetadata(XmlLanguage.GetLanguage("de-DE")));

Now the Inlines in TextBlock follows the culture that you have specified

 
Leave a comment

Posted by on September 25, 2014 in C-Sharp

 

Tags:

Done Building Project “X” (default targets) — FAILED.

If you use Team Foundation Server as build server and have a Database Project that is build on the server there is a chance that the build output succeeds without errors but the build result is “failed”. If you execute msbuild on the build server you can see that the DatabaseProject build succeeds with following output:

Done Building Project “X” (default targets) — FAILED.

Based on the documentation of the TFS-Build-Server any build output containing ERROR, FAILED,… is interpreted as a failed build, even though the msbuild script succeeded.
The problem is that you have not updated the SQL Server Data Tools. If you install the update on your build machine then the MsBuild-Script will succeed

 
Leave a comment

Posted by on September 19, 2014 in Team Foundation Server

 

Tags:

TFS does immediately not see group member changes.

When adding a user to a windows/domain group (e.g. TFS-Users) that has access to a repository on Team Foundation Server it may be that this user does not get immediate access to your Team Collection. This is because Team Foundation Server caches the user that are present in the group TFS-Users. Therefore any user change on the windows/domain group, either removal or addition, will not be reflected immediately to the Team Foundation Service. The solution is to wait some amount of time, since Team Foundation Service will re-query the windows/domain user group for eligible users every hour.

Note: It does not work to shut down the IIS-Webpage and restart it, this will not force a re-query of the windows/domain group.

 
Leave a comment

Posted by on September 11, 2014 in Team Foundation Server

 

Tags:

The located assembly’s manifest definition does not match the assembly reference

“System.IO.FileLoadException: Could not load file or assembly \”System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\” or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)”:”System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″

Looking in my solution explorer I can see I have referenced System.Windows.Interactivity, Version=4.5.0.0
Windows.Interactivity
But why does he complaint that version 4.0.0.0 is not found. The short answer for the problem is that another referenced library references itself System.Windows.Interactivity with version 4.0.0.0. Therefore, because version 4.5.0.0 is loaded by the version 4.0.0.0 is not found.

The solution is to configure a assemblyBinding in app.config.

This is done as follows:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
        <assemblyIdentity name="System.Windows.Interactivity" 
                          publicKeyToken=31bf3856ad364e35"
                          culture=neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.5.0.0"
                         newVersion="4.5.0.0" />
    </dependentAssembly>
</assemblyBinding>
 
1 Comment

Posted by on February 20, 2014 in C-Sharp

 
 
Follow

Get every new post delivered to your Inbox.