I created a new project in visual studio proj2 and I want it to have the same assembly references as proj1, so I opened proj1.csproj and copied:
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="system" />
<Reference Include="System.Windows" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="System.Net" />
<Reference Include="System.Windows.Browser" />
</ItemGroup>
and pasted it into proj1.csproj. The problem is that my System.Windows assembly reference has an exclamation mark beside it, and when I try to click it, it says:
This project cannot be viewed in the object browser because it is unavailable or not yet built. Please ensure that the project is available and built.
And of course in my .cs file, it says that
The type or namespace 'Windows' does not exist in the namespace 'System' (are you missing an assembly reference?)
How do I get my assembly references to work?
To fix a broken project reference by correcting the reference path. In Solution Explorer, right-click your project node, and then select Properties. The Project Designer appears. If you're using Visual Basic, select the References page, and then click the Reference Paths button.
Go to project properties and ensure you're targeting at least Framework 3.0.
System.Windows is WPF and it requires at least .NET 3.0 to be targeted by the project.
Given your update comment, here is the list of assemblies in the Client Profile. You will likely need to reference the full .NET 4 Framework to use System.Windows...
Also note that System.Windows.dll does not encapsulate the System.Windows namespace; much of that namespace is spread across the Presentation*.dll
assemblies. Double-check that the actual references being used by your first project appear in the second, for starters.
Also please consider posting the code from your .cs file that results in this error; it's possible a type you're using therein is actually held in a different assembly that you aren't referencing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With