2012-01-12 21:59:15 +00:00
|
|
|
--
|
2012-07-23 21:21:06 +00:00
|
|
|
-- vs2005_csproj.lua
|
2013-02-25 15:47:22 +00:00
|
|
|
-- Generate a Visual Studio 2005-2010 C# project.
|
|
|
|
-- Copyright (c) 2009-2013 Jason Perkins and the Premake project
|
2012-07-23 21:21:06 +00:00
|
|
|
--
|
|
|
|
|
2012-11-27 15:18:06 +00:00
|
|
|
premake.vstudio.cs2005 = {}
|
2013-07-12 15:07:26 +00:00
|
|
|
|
2012-07-23 21:21:06 +00:00
|
|
|
local vstudio = premake.vstudio
|
|
|
|
local cs2005 = premake.vstudio.cs2005
|
2013-09-13 15:15:36 +00:00
|
|
|
local project = premake.project
|
|
|
|
local config = premake.config
|
|
|
|
local fileconfig = premake.fileconfig
|
2012-11-27 15:28:17 +00:00
|
|
|
local dotnet = premake.tools.dotnet
|
2012-07-23 21:21:06 +00:00
|
|
|
|
|
|
|
|
2013-04-25 20:05:08 +00:00
|
|
|
cs2005.elements = {}
|
|
|
|
|
|
|
|
|
2012-07-23 21:21:06 +00:00
|
|
|
--
|
2012-01-12 21:59:15 +00:00
|
|
|
-- Generate a Visual Studio 200x C# project, with support for the new platforms API.
|
2012-07-23 21:21:06 +00:00
|
|
|
--
|
|
|
|
|
2013-04-25 20:05:08 +00:00
|
|
|
cs2005.elements.project = {
|
|
|
|
"projectElement",
|
|
|
|
"projectProperties",
|
2013-10-23 17:06:03 +00:00
|
|
|
"configurations",
|
|
|
|
"applicationIcon",
|
|
|
|
"assemblyReferences",
|
2013-04-25 20:05:08 +00:00
|
|
|
}
|
|
|
|
|
2013-09-13 15:52:00 +00:00
|
|
|
function cs2005.generate(prj)
|
2012-07-23 21:21:06 +00:00
|
|
|
io.indent = " "
|
2013-05-15 15:15:54 +00:00
|
|
|
io.utf8()
|
2013-02-25 15:47:22 +00:00
|
|
|
|
2013-04-25 20:05:08 +00:00
|
|
|
premake.callarray(cs2005, cs2005.elements.project, prj)
|
2012-07-23 21:21:06 +00:00
|
|
|
|
2012-08-07 21:03:23 +00:00
|
|
|
_p(1,'<ItemGroup>')
|
2012-07-23 21:21:06 +00:00
|
|
|
cs2005.files(prj)
|
2012-08-07 21:03:23 +00:00
|
|
|
_p(1,'</ItemGroup>')
|
2012-07-23 21:21:06 +00:00
|
|
|
|
2012-10-10 15:09:51 +00:00
|
|
|
cs2005.projectReferences(prj)
|
2013-04-25 20:05:08 +00:00
|
|
|
cs2005.targets(prj)
|
2012-11-28 16:14:47 +00:00
|
|
|
cs2005.buildEvents(prj)
|
|
|
|
|
2013-05-15 15:15:54 +00:00
|
|
|
io.printf('</Project>')
|
2012-07-23 21:21:06 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Write the opening <Project> element.
|
|
|
|
--
|
|
|
|
|
2013-04-25 20:05:08 +00:00
|
|
|
function cs2005.projectElement(prj)
|
2012-07-23 21:21:06 +00:00
|
|
|
if _ACTION > "vs2008" then
|
|
|
|
_p('<?xml version="1.0" encoding="utf-8"?>')
|
|
|
|
end
|
2013-04-25 20:05:08 +00:00
|
|
|
|
|
|
|
local ver = ''
|
|
|
|
local action = premake.action.current()
|
|
|
|
if action.vstudio.toolsVersion then
|
|
|
|
ver = string.format(' ToolsVersion="%s"', action.vstudio.toolsVersion)
|
|
|
|
end
|
|
|
|
_p('<Project%s DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">', ver)
|
2012-07-23 21:21:06 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Write the opening PropertyGroup, which contains the project-level settings.
|
|
|
|
--
|
|
|
|
|
2013-10-31 15:51:32 +00:00
|
|
|
cs2005.elements.projectProperties = {
|
|
|
|
"configurationCondition",
|
|
|
|
"platformCondition",
|
|
|
|
"productVersion",
|
|
|
|
"schemaVersion",
|
|
|
|
"projectGuid",
|
|
|
|
"outputType",
|
|
|
|
"appDesignerFolder",
|
|
|
|
"rootNamespace",
|
|
|
|
"assemblyName",
|
|
|
|
"targetFrameworkVersion",
|
|
|
|
"targetFrameworkProfile",
|
|
|
|
"fileAlignment",
|
2013-11-15 21:35:27 +00:00
|
|
|
"projectTypeGuids",
|
2013-10-31 15:51:32 +00:00
|
|
|
}
|
2012-07-23 21:21:06 +00:00
|
|
|
|
2013-10-31 15:51:32 +00:00
|
|
|
function cs2005.projectProperties(prj)
|
2012-07-23 21:21:06 +00:00
|
|
|
_p(1,'<PropertyGroup>')
|
|
|
|
local cfg = project.getfirstconfig(prj)
|
2013-10-31 15:51:32 +00:00
|
|
|
premake.callarray(cs2005, cs2005.elements.projectProperties, cfg)
|
2013-04-25 20:05:08 +00:00
|
|
|
_p(1,'</PropertyGroup>')
|
|
|
|
end
|
2012-07-23 21:21:06 +00:00
|
|
|
|
2013-02-25 15:47:22 +00:00
|
|
|
|
2013-04-25 20:05:08 +00:00
|
|
|
--
|
2013-10-23 17:06:03 +00:00
|
|
|
-- Write out the settings for the project configurations.
|
2013-04-25 20:05:08 +00:00
|
|
|
--
|
|
|
|
|
2013-10-23 17:06:03 +00:00
|
|
|
cs2005.elements.configuration = {
|
|
|
|
"propertyGroup",
|
|
|
|
"debugProps",
|
|
|
|
"outputProps",
|
|
|
|
"compilerProps",
|
|
|
|
}
|
|
|
|
|
|
|
|
function cs2005.configurations(prj)
|
|
|
|
for cfg in project.eachconfig(prj) do
|
|
|
|
cs2005.configuration(cfg)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function cs2005.configuration(cfg)
|
|
|
|
premake.callarray(cs2005, cs2005.elements.configuration, cfg)
|
2012-07-23 21:21:06 +00:00
|
|
|
_p(1,'</PropertyGroup>')
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-08-07 21:03:23 +00:00
|
|
|
--
|
|
|
|
-- Write out the source files item group.
|
|
|
|
--
|
|
|
|
|
|
|
|
function cs2005.files(prj)
|
2013-06-17 15:46:53 +00:00
|
|
|
-- Some settings applied at project level; can't be changed in cfg
|
|
|
|
local cfg = project.getfirstconfig(prj)
|
|
|
|
|
2012-08-07 21:03:23 +00:00
|
|
|
local tr = project.getsourcetree(prj)
|
|
|
|
premake.tree.traverse(tr, {
|
|
|
|
onleaf = function(node, depth)
|
2013-07-12 15:07:26 +00:00
|
|
|
local filecfg = fileconfig.getconfig(node, cfg)
|
2012-08-07 21:03:23 +00:00
|
|
|
local fname = path.translate(node.relpath)
|
2013-02-25 15:47:22 +00:00
|
|
|
|
2013-03-27 11:43:20 +00:00
|
|
|
-- Files that live outside of the project tree need to be "linked"
|
|
|
|
-- and provided with a project relative pseudo-path. Check for any
|
|
|
|
-- leading "../" sequences and, if found, remove them and mark this
|
|
|
|
-- path as external.
|
|
|
|
|
|
|
|
local link, count = node.relpath:gsub("%.%.%/", "")
|
|
|
|
local external = (count > 0)
|
|
|
|
|
|
|
|
-- Try to provide a little bit of flexibility by allowing virtual
|
|
|
|
-- paths for external files. Would be great to support them for all
|
|
|
|
-- files but Visual Studio chokes if file is already in project area.
|
|
|
|
|
|
|
|
if external and node.vpath ~= node.relpath then
|
|
|
|
link = node.vpath
|
|
|
|
end
|
|
|
|
|
2013-06-17 15:46:53 +00:00
|
|
|
-- Deduce what, if any, special attributes are required for this file.
|
|
|
|
-- For example, forms may have related source, designer, and resource
|
|
|
|
-- files which need to be associated.
|
|
|
|
|
|
|
|
local info = dotnet.fileinfo(filecfg)
|
|
|
|
|
|
|
|
-- If no additional attributes are required, write a simple element
|
|
|
|
|
|
|
|
if not info.subtype and not info.dependency and not external then
|
|
|
|
_p(2,'<%s Include="%s" />', info.action, fname)
|
|
|
|
|
2012-08-07 21:03:23 +00:00
|
|
|
else
|
2013-06-17 15:46:53 +00:00
|
|
|
_p(2,'<%s Include="%s">', info.action, fname)
|
2013-03-27 11:43:20 +00:00
|
|
|
|
2013-03-10 19:56:56 +00:00
|
|
|
if external then
|
2013-03-27 11:43:20 +00:00
|
|
|
_p(3,'<Link>%s</Link>', path.translate(link))
|
2013-03-10 19:56:56 +00:00
|
|
|
end
|
|
|
|
|
2013-11-15 22:17:41 +00:00
|
|
|
|
2013-06-17 15:46:53 +00:00
|
|
|
if info.subtype == "AutoGenerated" then
|
|
|
|
_p(3,"<AutoGen>True</AutoGen>")
|
|
|
|
|
|
|
|
elseif info.subtype == "Designer" then
|
2012-09-27 14:15:27 +00:00
|
|
|
_p(3,'<SubType>Designer</SubType>')
|
2013-11-15 22:17:41 +00:00
|
|
|
if info.generator then
|
|
|
|
_p(3,"<Generator>%s</Generator>", info.generator)
|
|
|
|
end
|
|
|
|
if info.generator == "ResXFileCodeGenerator" then
|
|
|
|
_x(3,'<LastGenOutput>%s.Designer.cs</LastGenOutput>', path.getbasename(node.name))
|
|
|
|
end
|
2013-06-17 15:46:53 +00:00
|
|
|
|
|
|
|
elseif info.subtype == "PreserveNewest" then
|
2012-09-27 14:15:27 +00:00
|
|
|
_p(3,'<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>')
|
2013-06-17 15:46:53 +00:00
|
|
|
|
|
|
|
elseif info.subtype then
|
|
|
|
_p(3,'<SubType>%s</SubType>', info.subtype)
|
|
|
|
|
2012-08-07 21:03:23 +00:00
|
|
|
end
|
2013-03-27 11:43:20 +00:00
|
|
|
|
2013-06-17 15:46:53 +00:00
|
|
|
if info.dependency then
|
2013-10-30 18:22:53 +00:00
|
|
|
local dependency = path.getrelative(path.getdirectory(filecfg.abspath), info.dependency)
|
|
|
|
_x(3,'<DependentUpon>%s</DependentUpon>', path.translate(dependency))
|
2012-08-07 21:03:23 +00:00
|
|
|
end
|
2013-03-27 11:43:20 +00:00
|
|
|
|
2013-06-17 15:46:53 +00:00
|
|
|
_p(2,'</%s>', info.action)
|
2012-08-07 21:03:23 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
}, false)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-11-28 16:14:47 +00:00
|
|
|
--
|
|
|
|
-- Write out pre- and post-build events, if provided.
|
|
|
|
--
|
|
|
|
|
|
|
|
function cs2005.buildEvents(prj)
|
|
|
|
local function output(name, steps)
|
|
|
|
if #steps > 0 then
|
|
|
|
_x(2,'<%sBuildEvent>%s</%sBuildEvent>', name, table.implode(steps, "", "", "\r\n"), name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if #prj.prebuildcommands > 0 or #prj.postbuildcommands > 0 then
|
|
|
|
_p(1,'<PropertyGroup>')
|
2013-02-25 15:47:22 +00:00
|
|
|
output("Pre", prj.prebuildcommands)
|
|
|
|
output("Post", prj.postbuildcommands)
|
2012-11-28 16:14:47 +00:00
|
|
|
_p(1,'</PropertyGroup>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-07-23 21:21:06 +00:00
|
|
|
--
|
2012-10-02 16:57:10 +00:00
|
|
|
-- Write the compiler flags for a particular configuration.
|
2012-07-23 21:21:06 +00:00
|
|
|
--
|
|
|
|
|
2012-10-02 16:57:10 +00:00
|
|
|
function cs2005.compilerProps(cfg)
|
|
|
|
_x(2,'<DefineConstants>%s</DefineConstants>', table.concat(cfg.defines, ";"))
|
2012-07-23 21:21:06 +00:00
|
|
|
|
|
|
|
_p(2,'<ErrorReport>prompt</ErrorReport>')
|
|
|
|
_p(2,'<WarningLevel>4</WarningLevel>')
|
|
|
|
|
|
|
|
if cfg.flags.Unsafe then
|
|
|
|
_p(2,'<AllowUnsafeBlocks>true</AllowUnsafeBlocks>')
|
|
|
|
end
|
2013-02-25 15:47:22 +00:00
|
|
|
|
2012-07-23 21:21:06 +00:00
|
|
|
if cfg.flags.FatalWarnings then
|
|
|
|
_p(2,'<TreatWarningsAsErrors>true</TreatWarningsAsErrors>')
|
|
|
|
end
|
2012-10-02 16:57:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Write out the debugging and optimization flags for a configuration.
|
|
|
|
--
|
|
|
|
|
|
|
|
function cs2005.debugProps(cfg)
|
|
|
|
if cfg.flags.Symbols then
|
|
|
|
_p(2,'<DebugSymbols>true</DebugSymbols>')
|
|
|
|
_p(2,'<DebugType>full</DebugType>')
|
|
|
|
else
|
|
|
|
_p(2,'<DebugType>pdbonly</DebugType>')
|
|
|
|
end
|
2013-09-13 15:15:36 +00:00
|
|
|
_p(2,'<Optimize>%s</Optimize>', iif(config.isOptimizedBuild(cfg), "true", "false"))
|
2012-10-02 16:57:10 +00:00
|
|
|
end
|
2012-07-23 21:21:06 +00:00
|
|
|
|
2012-10-02 16:57:10 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Write out the target and intermediates settings for a configuration.
|
|
|
|
--
|
|
|
|
|
|
|
|
function cs2005.outputProps(cfg)
|
2012-10-08 15:50:42 +00:00
|
|
|
local outdir = project.getrelative(cfg.project, cfg.buildtarget.directory)
|
2012-10-08 22:31:12 +00:00
|
|
|
_x(2,'<OutputPath>%s\\</OutputPath>', path.translate(outdir))
|
2013-02-25 15:47:22 +00:00
|
|
|
|
2012-10-02 16:57:10 +00:00
|
|
|
-- Want to set BaseIntermediateOutputPath because otherwise VS will create obj/
|
|
|
|
-- anyway. But VS2008 throws up ominous warning if present.
|
2012-10-08 15:50:42 +00:00
|
|
|
local objdir = path.translate(project.getrelative(cfg.project, cfg.objdir))
|
2012-10-02 16:57:10 +00:00
|
|
|
if _ACTION > "vs2008" then
|
2012-10-08 15:50:42 +00:00
|
|
|
_x(2,'<BaseIntermediateOutputPath>%s\\</BaseIntermediateOutputPath>', objdir)
|
2012-10-02 16:57:10 +00:00
|
|
|
_p(2,'<IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>')
|
|
|
|
else
|
2012-10-08 15:50:42 +00:00
|
|
|
_x(2,'<IntermediateOutputPath>%s\\</IntermediateOutputPath>', objdir)
|
2012-10-02 16:57:10 +00:00
|
|
|
end
|
2012-07-23 21:21:06 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-10-10 15:09:51 +00:00
|
|
|
--
|
|
|
|
-- Write the list of assembly (system, or non-sibling) references.
|
|
|
|
--
|
|
|
|
|
|
|
|
function cs2005.assemblyReferences(prj)
|
|
|
|
_p(1,'<ItemGroup>')
|
|
|
|
|
|
|
|
-- C# doesn't support per-configuration links (does it?) so just use
|
|
|
|
-- the settings from the first available config instead
|
2013-08-11 13:51:19 +00:00
|
|
|
local cfg = project.getfirstconfig(prj)
|
|
|
|
|
|
|
|
config.getlinks(cfg, "system", function(original, decorated)
|
|
|
|
if decorated:find("/", nil, true) then
|
|
|
|
_x(2,'<Reference Include="%s">', path.getbasename(decorated))
|
|
|
|
_x(3,'<HintPath>%s</HintPath>', path.translate(decorated))
|
|
|
|
|
|
|
|
if not config.isCopyLocal(prj, original, true) then
|
|
|
|
_p(3,"<Private>False</Private>")
|
|
|
|
end
|
|
|
|
|
2012-10-10 15:09:51 +00:00
|
|
|
_p(2,'</Reference>')
|
|
|
|
else
|
2013-08-11 13:51:19 +00:00
|
|
|
_x(2,'<Reference Include="%s" />', path.getbasename(decorated))
|
2012-10-10 15:09:51 +00:00
|
|
|
end
|
2013-08-11 13:51:19 +00:00
|
|
|
end)
|
2013-02-25 15:47:22 +00:00
|
|
|
|
2012-10-10 15:09:51 +00:00
|
|
|
_p(1,'</ItemGroup>')
|
2012-08-07 21:03:23 +00:00
|
|
|
end
|
|
|
|
|
2013-02-25 15:47:22 +00:00
|
|
|
|
2012-07-23 21:21:06 +00:00
|
|
|
--
|
|
|
|
-- Write the list of project dependencies.
|
|
|
|
--
|
|
|
|
function cs2005.projectReferences(prj)
|
|
|
|
_p(1,'<ItemGroup>')
|
|
|
|
|
2012-09-27 14:15:27 +00:00
|
|
|
local deps = project.getdependencies(prj)
|
|
|
|
if #deps > 0 then
|
|
|
|
for _, dep in ipairs(deps) do
|
2013-09-30 14:16:56 +00:00
|
|
|
local relpath = project.getrelative(prj, vstudio.projectfile(dep))
|
2012-09-27 14:15:27 +00:00
|
|
|
_x(2,'<ProjectReference Include="%s">', path.translate(relpath))
|
|
|
|
_p(3,'<Project>{%s}</Project>', dep.uuid)
|
|
|
|
_x(3,'<Name>%s</Name>', dep.name)
|
2013-08-11 13:51:19 +00:00
|
|
|
|
|
|
|
if not config.isCopyLocal(prj, dep.name, true) then
|
|
|
|
_p(3,"<Private>False</Private>")
|
|
|
|
end
|
|
|
|
|
2012-09-27 14:15:27 +00:00
|
|
|
_p(2,'</ProjectReference>')
|
|
|
|
end
|
2012-07-23 21:21:06 +00:00
|
|
|
end
|
2013-02-25 15:47:22 +00:00
|
|
|
|
2012-07-23 21:21:06 +00:00
|
|
|
_p(1,'</ItemGroup>')
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Return the Visual Studio architecture identification string. The logic
|
2013-02-25 15:47:22 +00:00
|
|
|
-- to select this is getting more complicated in VS2010, but I haven't
|
2012-07-23 21:21:06 +00:00
|
|
|
-- tackled all the permutations yet.
|
|
|
|
--
|
|
|
|
|
2012-11-26 19:05:33 +00:00
|
|
|
function cs2005.arch(cfg)
|
|
|
|
local arch = vstudio.archFromConfig(cfg)
|
|
|
|
if arch == "Any CPU" then
|
|
|
|
arch = "AnyCPU"
|
|
|
|
end
|
|
|
|
return arch
|
2012-07-23 21:21:06 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Write the PropertyGroup element for a specific configuration block.
|
|
|
|
--
|
|
|
|
|
2012-11-26 19:05:33 +00:00
|
|
|
function cs2005.propertyGroup(cfg)
|
|
|
|
local arch = cs2005.arch(cfg)
|
|
|
|
_x(1,'<PropertyGroup Condition=" \'$(Configuration)|$(Platform)\' == \'%s|%s\' ">', cfg.buildcfg, arch)
|
|
|
|
if arch ~= "AnyCPU" or _ACTION > "vs2008" then
|
|
|
|
_x(2,'<PlatformTarget>%s</PlatformTarget>', arch)
|
2012-07-23 21:21:06 +00:00
|
|
|
end
|
|
|
|
end
|
2013-02-25 15:47:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Generators for individual project elements.
|
|
|
|
--
|
|
|
|
|
|
|
|
function cs2005.applicationIcon(prj)
|
|
|
|
if prj.icon then
|
|
|
|
local icon = path.translate(project.getrelative(prj, prj.icon))
|
|
|
|
_p(1,'<PropertyGroup>')
|
|
|
|
_x(2,'<ApplicationIcon>%s</ApplicationIcon>', icon)
|
|
|
|
_p(1,'</PropertyGroup>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-04-25 20:05:08 +00:00
|
|
|
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
--
|
|
|
|
-- Handlers for individual project elements
|
|
|
|
--
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
2013-10-31 15:51:32 +00:00
|
|
|
function cs2005.appDesignerFolder(cfg)
|
|
|
|
_p(2,'<AppDesignerFolder>Properties</AppDesignerFolder>')
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function cs2005.assemblyName(cfg)
|
|
|
|
_p(2,'<AssemblyName>%s</AssemblyName>', cfg.buildtarget.basename)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function cs2005.configurationCondition(cfg)
|
|
|
|
_x(2,'<Configuration Condition=" \'$(Configuration)\' == \'\' ">%s</Configuration>', cfg.buildcfg)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function cs2005.fileAlignment(cfg)
|
2013-04-25 20:05:08 +00:00
|
|
|
if _ACTION >= "vs2010" then
|
|
|
|
_p(2,'<FileAlignment>512</FileAlignment>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-10-31 15:51:32 +00:00
|
|
|
function cs2005.outputType(cfg)
|
|
|
|
_p(2,'<OutputType>%s</OutputType>', dotnet.getkind(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function cs2005.platformCondition(cfg)
|
|
|
|
_p(2,'<Platform Condition=" \'$(Platform)\' == \'\' ">%s</Platform>', cs2005.arch(cfg.project))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function cs2005.productVersion(cfg)
|
2013-04-25 20:05:08 +00:00
|
|
|
local action = premake.action.current()
|
|
|
|
if action.vstudio.productVersion then
|
|
|
|
_p(2,'<ProductVersion>%s</ProductVersion>', action.vstudio.productVersion)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-10-31 15:51:32 +00:00
|
|
|
function cs2005.projectGuid(cfg)
|
|
|
|
_p(2,'<ProjectGuid>{%s}</ProjectGuid>', cfg.uuid)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-11-15 21:35:27 +00:00
|
|
|
function cs2005.projectTypeGuids(cfg)
|
|
|
|
if cfg.flags.WPF then
|
|
|
|
_p(2,'<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-10-31 15:51:32 +00:00
|
|
|
function cs2005.rootNamespace(cfg)
|
|
|
|
_p(2,'<RootNamespace>%s</RootNamespace>', cfg.namespace or cfg.buildtarget.basename)
|
|
|
|
end
|
|
|
|
|
2013-04-25 20:05:08 +00:00
|
|
|
|
2013-10-31 15:51:32 +00:00
|
|
|
function cs2005.schemaVersion(cfg)
|
2013-04-25 20:05:08 +00:00
|
|
|
local action = premake.action.current()
|
|
|
|
if action.vstudio.csprojSchemaVersion then
|
|
|
|
_p(2,'<SchemaVersion>%s</SchemaVersion>', action.vstudio.csprojSchemaVersion)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-10-31 15:51:32 +00:00
|
|
|
function cs2005.targetFrameworkVersion(cfg)
|
2013-04-25 20:05:08 +00:00
|
|
|
local action = premake.action.current()
|
2013-10-31 15:51:32 +00:00
|
|
|
local framework = cfg.framework or action.vstudio.targetFramework
|
2013-04-25 20:05:08 +00:00
|
|
|
if framework then
|
|
|
|
_p(2,'<TargetFrameworkVersion>v%s</TargetFrameworkVersion>', framework)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-10-31 15:51:32 +00:00
|
|
|
function cs2005.targetFrameworkProfile(cfg)
|
2013-04-25 20:05:08 +00:00
|
|
|
if _ACTION == "vs2010" then
|
2013-05-15 15:15:54 +00:00
|
|
|
_p(2,'<TargetFrameworkProfile>')
|
|
|
|
_p(2,'</TargetFrameworkProfile>')
|
2013-04-25 20:05:08 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function cs2005.targets(prj)
|
|
|
|
local bin = iif(_ACTION <= "vs2010", "MSBuildBinPath", "MSBuildToolsPath")
|
|
|
|
_p(1,'<Import Project="$(%s)\\Microsoft.CSharp.targets" />', bin)
|
|
|
|
_p(1,'<!-- To modify your build process, add your task inside one of the targets below and uncomment it.')
|
|
|
|
_p(1,' Other similar extension points exist, see Microsoft.Common.targets.')
|
|
|
|
_p(1,'<Target Name="BeforeBuild">')
|
|
|
|
_p(1,'</Target>')
|
|
|
|
_p(1,'<Target Name="AfterBuild">')
|
|
|
|
_p(1,'</Target>')
|
|
|
|
_p(1,'-->')
|
|
|
|
end
|