vs2005_csproj.lua 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. --
  2. -- vs2005_csproj.lua
  3. -- Generate a Visual Studio 2005+ C# project.
  4. -- Copyright (c) Jason Perkins and the Premake project
  5. --
  6. local p = premake
  7. p.vstudio.cs2005 = {}
  8. local vstudio = p.vstudio
  9. local cs2005 = p.vstudio.cs2005
  10. local dotnetbase = p.vstudio.dotnetbase
  11. local project = p.project
  12. local config = p.config
  13. local fileconfig = p.fileconfig
  14. local dotnet = p.tools.dotnet
  15. cs2005.elements = {}
  16. cs2005.elements.project = function (prj)
  17. if dotnetbase.isNewFormatProject(prj) then
  18. return {
  19. dotnetbase.projectElement,
  20. dotnetbase.projectProperties,
  21. dotnetbase.configurations,
  22. dotnetbase.applicationIcon,
  23. dotnetbase.references
  24. }
  25. else
  26. return {
  27. dotnetbase.xmlDeclaration,
  28. dotnetbase.projectElement,
  29. dotnetbase.commonProperties,
  30. dotnetbase.projectProperties,
  31. dotnetbase.configurations,
  32. dotnetbase.applicationIcon,
  33. dotnetbase.references
  34. }
  35. end
  36. end
  37. cs2005.elements.projectProperties = function (cfg)
  38. if dotnetbase.isNewFormatProject(cfg) then
  39. return {
  40. dotnetbase.outputType,
  41. dotnetbase.appDesignerFolder,
  42. dotnetbase.rootNamespace,
  43. dotnetbase.assemblyName,
  44. dotnetbase.netcore.targetFramework,
  45. dotnetbase.allowUnsafeBlocks,
  46. dotnetbase.fileAlignment,
  47. dotnetbase.bindingRedirects,
  48. dotnetbase.netcore.useWpf,
  49. dotnetbase.csversion,
  50. dotnetbase.netcore.enableDefaultCompileItems,
  51. }
  52. else
  53. return {
  54. dotnetbase.configurationCondition,
  55. dotnetbase.platformCondition,
  56. dotnetbase.productVersion,
  57. dotnetbase.schemaVersion,
  58. dotnetbase.projectGuid,
  59. dotnetbase.outputType,
  60. dotnetbase.appDesignerFolder,
  61. dotnetbase.rootNamespace,
  62. dotnetbase.assemblyName,
  63. dotnetbase.targetFrameworkVersion,
  64. dotnetbase.targetFrameworkProfile,
  65. dotnetbase.fileAlignment,
  66. dotnetbase.bindingRedirects,
  67. dotnetbase.projectTypeGuids,
  68. dotnetbase.csversion,
  69. }
  70. end
  71. end
  72. cs2005.elements.configuration = function ()
  73. return {
  74. dotnetbase.propertyGroup,
  75. dotnetbase.debugProps,
  76. dotnetbase.outputProps,
  77. dotnetbase.compilerProps,
  78. dotnetbase.NoWarn
  79. }
  80. end
  81. function cs2005.generate(prj)
  82. dotnetbase.prepare(cs2005)
  83. dotnetbase.generate(prj)
  84. end
  85. function cs2005.targets(prj)
  86. if not dotnetbase.isNewFormatProject(prj) then
  87. local bin = iif(_ACTION <= "vs2010", "MSBuildBinPath", "MSBuildToolsPath")
  88. _p(1,'<Import Project="$(%s)\\Microsoft.CSharp.targets" />', bin)
  89. _p(1,'<!-- To modify your build process, add your task inside one of the targets below and uncomment it.')
  90. _p(1,' Other similar extension points exist, see Microsoft.Common.targets.')
  91. _p(1,'<Target Name="BeforeBuild">')
  92. _p(1,'</Target>')
  93. _p(1,'<Target Name="AfterBuild">')
  94. _p(1,'</Target>')
  95. _p(1,'-->')
  96. end
  97. end