OK. I was going a little crazy today with a WPF project. I'm using VS2010 with .NET 4.0 and I added a simple reference to another project in my solution, added a member variable of one of the referenced types and tried to compile. Nothing. Well, something. It did not r开发者_如何学Pythonecognize the type at all.
I verified at the namespace using statement. Intellisense seemed to like it. In fact, Visual Studio is perfectly content to let me browse into the class via the Go To Definition function.
Some of you reading this already know what this is, but I thought I was going crazy.
The WPF project defaults to the Client Profile, while the other projects are targeting the full .NET 4.0. I had the warnings turned off (stupid), so I wasn't seeing the warning message about the client profile mismatch.
Does anyone else think it's stupid to have WPF projects default to Client Profile targeting, while the rest of the projects default to targeting the full .NET 4.0?
...Which leads me to my question. Is it possible to change this default, so this scenario doesn't happen again? I would like to always target one platform or the other.
Many project types in VS2010 target the client profile. MS is making a bigger push this time around to get the 4.0 client profile to take hold (the 3.5 client profile was largely ignored).
For what it's worth, what profile a project type targets by default is defined in its template, and easy to change if you desire ([VS Root]\Common7\IDE\ProjectTemplates and alter the TargetFrameworkProfile
element inside the csproj files inside the templates as you see fit). I don't recommend this though.
Generally speaking, as inelegant as it may be, I think we just have to get used to the idea that the client profile is more prominent now and be more aware of it as we work with VS2010
精彩评论