5

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

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.

Grant Thomas
  • 44,454
  • 10
  • 85
  • 129
Reinderien
  • 11,755
  • 5
  • 49
  • 77

4 Answers4

13
  • 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.
Samidjo
  • 2,315
  • 30
  • 37
5

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.

Brian Kretzler
  • 9,748
  • 1
  • 31
  • 28
  • Good suggestion, but in fact the thing that did it is here: http://code.google.com/p/benfwaves/source/browse/trunk/BenfWaves.Client/BenfWaves.Client.csproj From lines 21 to 32. – Reinderien Mar 23 '11 at 00:13
  • This solution helped me. I run msbuild from command line and both Configuration and Platform parameters default to something that didnt work in my case. By explicitly specifying both parameters worked for me, eg.: `msbuild.exe MyApp.sln /p:Configuration=Debug /p:Platform=Win32` – papaiatis Nov 05 '14 at 14:31
3

I see that you've fixed configuration errors in your sln. Resx problem is the same as described here.

Community
  • 1
  • 1
Sergio Rykov
  • 4,176
  • 25
  • 23
0

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"

BigPete
  • 779
  • 2
  • 9
  • 21
  • The problem was that the GUI Solution Build Configuration was missing entries. I solved that particular problem (see updated question text), but still nothing compiles in .NET 3.5. – Reinderien Mar 22 '11 at 19:30