msbuild works on command line but VS2010 says a project is "not selected"
The relevant solution and project files for this question are at:
http://code.google.com/p/benfwaves/source/browse/trunk/BenfWaves.sln?r=26
http://code.google.com/p/benfwaves/source/browse/trunk/BenfWaves.Library/BenfWaves.Library.csproj?r=26
http://code.google.com/p/benfwaves/source/browse/trunk/BenfWaves.Client/BenfWaves.Client.csproj?r=26
http://code.google.com/p/benfwaves/source/browse/trunk/BenfWaves.Tests/BenfWaves.Tests.csproj?r=26开发者_JAVA技巧
I've tried to refactor the project files to eliminate redundancy and allow for compilation to .NET 3.5 as well as .NET 4.0. Currently, the VS2010 IDE can compile for Any CPU on .NET 4.0. If I try Any CPU for .NET 3.5, it says:
Error 1 Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Line 123, position 5. D:\projects\BenfWaves\trunk\BenfWaves.Client\Properties\Resources.resx 123 5 BenfWaves.Client
I read that this may be a problem with resgen.exe, but changing the 32-bit flag on that file didn't improve the situation any. Also, the IDE doesn't believe that the projects have configurations for anything other than Any CPU, which produces the following problem:
------ Skipped Build: Project: BenfWaves.Library, Configuration: Debug-4.0 Any CPU ------
Project not selected to build for this solution configuration
------ Build started: Project: BenfWaves.Client, Configuration: Debug-4.0 x86 ------
BenfWaves.Client -> D:\projects\BenfWaves\trunk\BenfWaves.Client\bin\x86\Debug-4.0\BenfWaves.Client.exe
------ Skipped Build: Project: BenfWaves.Tests, Configuration: Debug-4.0 Any CPU ------
Project not selected to build for this solution configuration
========== Build: 1 succeeded or up-to-date, 0 failed, 2 skipped ==========
It's skipping things that it shouldn't. msbuild from the command line works on all three platforms and doesn't skip anything.
Any suggestions would be quite welcome. Thanks.
Edit: After rev 27, at least the "not selected" problem isn't there anymore because I added dummy configuration lines to the projects to fool VS2010 into working. However, the resource compilation problem under .NET 3.5 still persists.
- In solution Explorer, right click on Solution
- then go to Configuration Manager
- Make sure that Build column is checked for the projects you want to build every time.
Try ensuring that both $(Configuration) and $(Platform) have a default value, by putting these lines first in your first PropertyGroup...
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
This might be relevant because the IDE treats these properties in a special way and may be confused if they have no value when the project is loaded.
I see that you've fixed configuration errors in your sln. Resx problem is the same as described here.
You might want to try editing your Solution build configuration.
http://msdn.microsoft.com/en-us/library/kwybya3w.aspx
follow the directions under the heading "To select and edit a Solution Build Configuration"
精彩评论