diff --git a/src/actions/vstudio/vs2005_csproj.lua b/src/actions/vstudio/vs2005_csproj.lua index e35e7814..d27196d0 100644 --- a/src/actions/vstudio/vs2005_csproj.lua +++ b/src/actions/vstudio/vs2005_csproj.lua @@ -1,13 +1,22 @@ -- -- vs2005_csproj.lua -- Generate a Visual Studio 2005/2008 C# project. --- Copyright (c) 2009 Jason Perkins and the Premake project +-- Copyright (c) 2009-2010 Jason Perkins and the Premake project -- - -- - -- Figure out what elements a particular source code file need in its item - -- block, based on its build action and any related files in the project. - -- +-- +-- Set up namespaces +-- + + premake.vstudio.cs2005 = { } + local vstudio = premake.vstudio + local cs2005 = premake.vstudio.cs2005 + + +-- +-- Figure out what elements a particular source code file need in its item +-- block, based on its build action and any related files in the project. +-- local function getelements(prj, action, fname) @@ -61,6 +70,32 @@ end +-- +-- Write the opening element and project level block. +-- + + function cs2005.projectheader(prj) + local vsversion, toolversion + if _ACTION == "vs2005" then + vsversion = "8.0.50727" + toolversion = nil + elseif _ACTION == "vs2008" then + vsversion = "9.0.21022" + toolversion = "3.5" + end + + if toolversion then + _p('', toolversion) + else + _p('') + end + end + + +-- +-- The main function: write the project file. +-- + function premake.vs2005_csproj(prj) io.eol = "\r\n" diff --git a/src/base/api.lua b/src/base/api.lua index 5601f230..83a4d886 100644 --- a/src/base/api.lua +++ b/src/base/api.lua @@ -102,6 +102,20 @@ } }, + framework = + { + kind = "string", + scope = "container", + allowed = { + "1.0", + "1.1", + "2.0", + "3.0", + "3.5", + "4.0" + } + }, + imageoptions = { kind = "list", diff --git a/tests/actions/vstudio/test_vs2005_csproj.lua b/tests/actions/vstudio/test_vs2005_csproj.lua new file mode 100644 index 00000000..b300cf56 --- /dev/null +++ b/tests/actions/vstudio/test_vs2005_csproj.lua @@ -0,0 +1,55 @@ +-- +-- tests/actions/test_vs2005_csproj.lua +-- Automated test suite for Visual Studio 2005-2008 C# project generation. +-- Copyright (c) 2010 Jason Perkins and the Premake project +-- + + T.vs2005_csproj = { } + local suite = T.vs2005_csproj + local cs2005 = premake.vstudio.cs2005 + +-- +-- Configure a solution for testing +-- + + local sln, prj + function suite.setup() + _ACTION = "vs2005" + + sln = solution "MySolution" + configurations { "Debug", "Release" } + platforms {} + + prj = project "MyProject" + language "C#" + kind "ConsoleApp" + uuid "AE61726D-187C-E440-BD07-2556188A6565" + end + + local function prepare() + io.capture() + premake.buildconfigs() + end + + +-- +-- Project header tests +-- + + function suite.projectheader_OnVs2005() + _ACTION = "vs2005" + prepare() + cs2005.projectheader(prj) + test.capture [[ + + ]] + end + + function suite.projectheader_OnVs2008() + _ACTION = "vs2008" + prepare() + cs2005.projectheader(prj) + test.capture [[ + + ]] + end diff --git a/tests/premake4.lua b/tests/premake4.lua index 2f03c6ac..ff89d37a 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -63,6 +63,7 @@ dofile("test_vs2003_sln.lua") dofile("test_vs2005_sln.lua") dofile("test_vs2008_sln.lua") + dofile("actions/vstudio/test_vs2005_csproj.lua") dofile("actions/vstudio/test_vs200x_vcproj.lua") -- Xcode tests