Added support for local assembly references to Visual Studio Managed C++ projects

This commit is contained in:
Jason Perkins 2013-03-05 11:00:32 -05:00
parent d3ec20d1c3
commit ffc53d870e
5 changed files with 48 additions and 3 deletions

View File

@ -32,6 +32,7 @@
* Added startproject() to specify solution startup project
* Added ExcludeFromBuild flag to mark source files as non-buildable
* Added MultiProcessorCompile flag to run multiple compiler processes
* Fixed assembly references for Visual Studio Managed C++ projects
-------

View File

@ -683,7 +683,7 @@
local refs = config.getlinks(cfg, "system", "fullpath", "managed")
table.foreachi(refs, function(value)
_p(2,'<AssemblyReference')
_x(3,'RelativePath="%s"', value)
_x(3,'RelativePath="%s"', path.translate(value))
_p(2,'/>')
end)
end

View File

@ -305,13 +305,25 @@
--
function vc2010.assemblyReferences(prj)
-- Visual Studio doesn't support per-config references
-- Visual Studio doesn't support per-config references; use
-- whatever is contained in the first configuration
local cfg = project.getfirstconfig(prj)
local refs = config.getlinks(cfg, "system", "fullpath", "managed")
if #refs > 0 then
_p(1,'<ItemGroup>')
table.foreachi(refs, function(value)
_x(2,'<Reference Include="%s" />', path.getbasename(value))
-- If the link contains a '/' then it is a relative path to
-- a local assembly. Otherwise treat it as a system assembly.
if value:find('/', 1, true) then
_x(2,'<Reference Include="%s">', path.getbasename(value))
_x(3,'<HintPath>%s</HintPath>', path.translate(value))
_p(2,'</Reference>')
else
_x(2,'<Reference Include="%s" />', path.getbasename(value))
end
end)
_p(1,'</ItemGroup>')
end

View File

@ -67,3 +67,18 @@
/>
]]
end
--
-- Local (non-system) assemblies can be referenced with a relative path.
--
function suite.canReferenceLocalAssembly()
links { "../nunit.framework.dll" }
prepare()
test.capture [[
<AssemblyReference
RelativePath="..\nunit.framework.dll"
/>
]]
end

View File

@ -65,3 +65,20 @@
</ItemGroup>
]]
end
--
-- Local (non-system) assemblies can be referenced with a relative path.
--
function suite.canReferenceLocalAssembly()
links { "../nunit.framework.dll" }
prepare()
test.capture [[
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
]]
end