简体   繁体   English

msbuild在命令行上工作,但VS2010表示项目“未选中”

[英]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.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.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.Client/BenfWaves.Client.csproj?r=26

http://code.google.com/p/benfwaves/source/browse/trunk/BenfWaves.Tests/BenfWaves.Tests.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. 我试图重构项目文件以消除冗余,并允许编译到.NET 3.5以及.NET 4.0。 Currently, the VS2010 IDE can compile for Any CPU on .NET 4.0. 目前,VS2010 IDE可以在.NET 4.0上为任何CPU编译。 If I try Any CPU for .NET 3.5, it says: 如果我尝试任何CPU for .NET 3.5,它说:

Error 1 Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. 错误1无法加载文件或程序集'System.Drawing,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一。 The system cannot find the file specified. 该系统找不到指定的文件。 Line 123, position 5. D:\\projects\\BenfWaves\\trunk\\BenfWaves.Client\\Properties\\Resources.resx 123 5 BenfWaves.Client 第123行,第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. 我读到这可能是resgen.exe的问题,但更改该文件上的32位标志并没有改善任何情况。 Also, the IDE doesn't believe that the projects have configurations for anything other than Any CPU, which produces the following problem: 此外,IDE不相信项目具有除Any CPU以外的任何配置,这会产生以下问题:

------ 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. 命令行中的msbuild适用于所有三个平台,不会跳过任何内容。

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. 编辑:在第27版之后,至少“未选择”问题不再存在,因为我在项目中添加了虚拟配置行,以欺骗VS2010工作。 However, the resource compilation problem under .NET 3.5 still persists. 但是,.NET 3.5下的资源编译问题仍然存在。

  • In solution Explorer, right click on Solution 在解决方案Explorer中,右键单击Solution
  • then go to Configuration Manager 然后转到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... 尝试通过将这些行首先放在第一个PropertyGroup中来确保$(Configuration)和$(Platform)都有默认值...

<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. 这可能是相关的,因为IDE以特殊方式处理这些属性,如果在加载项目时它们没有值,则可能会混淆。

I see that you've fixed configuration errors in your sln. 我看到你修复了sln中的配置错误。 Resx problem is the same as described here . Resx问题与此处描述的相同。

You might want to try editing your Solution build configuration. 您可能想尝试编辑解决方案构建配置。

http://msdn.microsoft.com/en-us/library/kwybya3w.aspx http://msdn.microsoft.com/en-us/library/kwybya3w.aspx

follow the directions under the heading "To select and edit a Solution Build Configuration" 按照“选择和编辑解决方案构建配置”标题下的说明进行操作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM