Unable to select Target framework for XNA 4.0 games
Asked Answered
A

3

7

I have an XNA 4.0 project that I would like to be compiled with the .Net 4.0 Full profile, but it is set to Client profile by default. The Target framework combobox in the Application tab is grayed out.

I have uninstalled and reinstalled .Net 3.5, .Net 4.0 and Xna 4.0. What could be the problem? Our other development machines do not have this problem.

enter image description here

Aubarta answered 29/6, 2011 at 14:35 Comment(2)
Are you able to create a fresh XNA project and reproduce the problem in that?Afrikaner
In a fresh XNA project it is perfectly reproduceable.Aubarta
A
7

I found a workaround:

In the .csproj file is an xml element called TargetFrameworkProfile which is set to Client. When I remove the word Client and thus empty the xml node, the project is built as a full .Net 4.0 assembly.

You can even upgrade the project to .NET 4.5 or higher by changing the TargetFrameworkVersion element. We use this to be able to use the Kinect One camera in XNA games.

<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
Aubarta answered 12/7, 2011 at 8:2 Comment(0)
A
0

Where do you see that your project is set to the client framework? I created several XNA-projects but never got problems with this.

My Target framework box is disabled too.

If you're getting bugs, I think you've to search for another cause.

Greatings

Abebi answered 11/7, 2011 at 19:1 Comment(2)
When you add a reference it mentions "Filtered to: .Net Framework 4 Client Profile" on top. Also in the .csproj file TargetFrameworkProfile is set to Client. I don't get bugs, but it is annoying I can't use certain references such as the content manipulation pipeline functionality in XNA.Aubarta
If you reference a .Net Framework 4 (full profile) assembly that uses something outside of the Client Profile (such as System.Web.HttpUtility.UrlDecode) from within your XNA project, the build will fail with a ton of ambiguous error messages for every type you reference: The type or namespace ... could not be found (are you missing a using directive or an assembly reference?). Updating as Wouter suggests fixes the problem.Buck
B
0

Per Wouter's answer, here is the proper XML in the .csproj file:

<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile></TargetFrameworkProfile>
Buck answered 24/12, 2013 at 13:52 Comment(2)
Why is <TargetFrameworkProfile></TargetFrameworkProfile> necessary?Reconstruction
To demonstrate (per Wouter's answer) that it should not contain the text Client. It should be empty.Buck

© 2022 - 2024 — McMap. All rights reserved.