Build with msbuild and dynamically set project references

前端 未结 2 1921
梦如初夏
梦如初夏 2021-02-03 13:23

I have a couple of projects which reference SQL Server assemblies. With SQL Server 2005 and SQL Server 2008 I am currently maintaining 2 project files which point to the same so

2条回答
  •  梦毁少年i
    2021-02-03 13:57

    Every MSBuild element (ok almost every) can have a Condition associated with it. What I would suggest is that you edit the project file (which is an MSBuild file itself) and place all the SQL server references in an ItemGroup which has a condition on it for instance:

      
        
        
      
    

    And another ItemGroup for Sql server 2008:

      
        
        
      
    

    You should provide a default value for the property SqlServerTargetEdition before those items are declared. Then at the command line you can override that value using the /p switch when invoking msbuild.exe.

    Sayed Ibrahim Hashimi

    My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build

提交回复
热议问题