Visual Studio C# projects can now link to external files
This commit is contained in:
parent
b10f1b5b60
commit
2d5a5910e6
@ -23,6 +23,7 @@
|
||||
* Added forceinclude() to specify forced include files
|
||||
* Visual Studio C# projects now support architectures
|
||||
* Visual Studio C# projects now support pre- and post-build commands
|
||||
* Visual Studio C# projects can now link to external files
|
||||
* Added NoImplicitLink flag to force explicit linking from Visual Studio
|
||||
* Decoupled VS2010 smaller type checks (/RTCc) from extra warnings (/W4)
|
||||
* Added NoRuntimeChecks flag to disable Visual Studio default checks
|
||||
|
@ -139,12 +139,17 @@
|
||||
|
||||
local action = dotnet.getbuildaction(filecfg)
|
||||
local fname = path.translate(node.relpath)
|
||||
local external = node.relpath:startswith("../")
|
||||
local elements, dependency = cs2005.getrelated(prj, filecfg, action)
|
||||
|
||||
if elements == "None" then
|
||||
if elements == "None" and not external then
|
||||
_p(2,'<%s Include="%s" />', action, fname)
|
||||
else
|
||||
_p(2,'<%s Include="%s">', action, fname)
|
||||
if external then
|
||||
_p(3,'<Link>%s</Link>', path.getname(fname))
|
||||
end
|
||||
|
||||
if elements == "AutoGen" then
|
||||
_p(3,'<AutoGen>True</AutoGen>')
|
||||
elseif elements == "AutoGenerated" then
|
||||
@ -153,7 +158,7 @@
|
||||
_x(3,'<LastGenOutput>%s.Designer.cs</LastGenOutput>', path.getbasename(node.name))
|
||||
elseif elements == "PreserveNewest" then
|
||||
_p(3,'<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>')
|
||||
elseif elements then
|
||||
elseif elements ~= "None" then
|
||||
_p(3,'<SubType>%s</SubType>', elements)
|
||||
end
|
||||
if dependency then
|
||||
|
@ -10,15 +10,15 @@
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local sln, prj
|
||||
|
||||
|
||||
function suite.setup()
|
||||
sln = test.createsolution()
|
||||
end
|
||||
|
||||
|
||||
local function prepare()
|
||||
prj = premake.solution.getproject_ng(sln, 1)
|
||||
cs2005.files(prj)
|
||||
@ -46,20 +46,6 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- The relative path to the file is correct for files that live outside
|
||||
-- the project's folder.
|
||||
--
|
||||
|
||||
function suite.filesUseRelativePath_onOutOfTreePath()
|
||||
files { "../Src/Hello.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="..\Src\Hello.cs" />
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test file dependencies
|
||||
--
|
||||
@ -96,3 +82,32 @@
|
||||
</Content>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Files that exist outside the project folder should be added as
|
||||
-- links, with a relative path. Weird but true.
|
||||
--
|
||||
|
||||
function suite.usesLinks_onExternalSourceFile()
|
||||
files { "../Src/Hello.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="..\Src\Hello.cs">
|
||||
<Link>Hello.cs</Link>
|
||||
</Compile>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.copyAction_onExternalResource()
|
||||
files { "../Resources/Hello.txt" }
|
||||
configuration "**.txt"
|
||||
buildaction "Copy"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Content Include="..\Resources\Hello.txt">
|
||||
<Link>Hello.txt</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
]]
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user