1

I'm trying to compile the project with targeted framework as ".NETFramework 4.0". But I get the following warning:

The primary reference "XXX" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "Fdi" or retarget your application to a framework version which contains "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".

1 Answer 1

2

I found an earlier (but similar) problem: Visual Studio 2010: Reference Assemblies Targeting Higher Framework Version

Johannes Rudolph found this answer on MSDN's forums ( http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/dfadfb34-5328-4c53-8274-931c6ae00836 ):

However, there're 2 workarounds.

Option 1:

Step1: Unload the referencing project targeting .NET 2.0

Step2: Right click the unloaded project and select edit from context menu

Step3: Add <SpecificVersion>true</SpecificVersion> to the reference. Below is a sample from my repro solution:

<ProjectReference Include="..\HighFX\HighFX.csproj">
<Project>{8DD71CAF-BEF7-40ED-9DD0-25033CD8009D}</Project>
<Name>HighFX</Name>
<SpecificVersion>true</SpecificVersion>
</ProjectReference>

Step4: Reload the project. Now your should be able to build within the Visual Studio 2010, there could still be a warning as below, but the build can be successful.

Warning 1 The project 'XXX' cannot be referenced. The referenced project is targeted to a higher framework version (3.5)

Option2:

Use the command line tool csc.exe to build each of your source file, which won't prevent the building.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.