diff options
| author | ruki <[email protected]> | 2026-03-16 23:48:44 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-03-16 23:48:44 +0800 |
| commit | 8aa975d2fc26c603146c933684aba299bd3dc60c (patch) | |
| tree | 7171a1e31b74bd464bfd3097ae9afbce6830d541 | |
| parent | 9ef3fac69885dccdb5feb27fed261b05984b914b (diff) | |
improve to get csproj file
| -rw-r--r-- | xmake/modules/core/tools/dotnet.lua | 4 | ||||
| -rw-r--r-- | xmake/rules/csharp/build/target.lua | 11 |
2 files changed, 5 insertions, 10 deletions
diff --git a/xmake/modules/core/tools/dotnet.lua b/xmake/modules/core/tools/dotnet.lua index 62d9a63d2..9a502b616 100644 --- a/xmake/modules/core/tools/dotnet.lua +++ b/xmake/modules/core/tools/dotnet.lua @@ -68,7 +68,7 @@ function nf_warning(self, level) end -- get the .csproj file from source files -function _get_csprojfile(sourcefiles, opt) +function _get_csprojfile(opt) local target = opt and opt.target if target then local csprojfile = target:data("csharp.csproj") @@ -100,7 +100,7 @@ function buildargv(self, sourcefiles, targetkind, targetfile, flags, opt) local argv = {"build"} -- add .csproj file - local csprojfile = _get_csprojfile(sourcefiles, opt) + local csprojfile = _get_csprojfile(opt) if csprojfile then table.insert(argv, csprojfile) end diff --git a/xmake/rules/csharp/build/target.lua b/xmake/rules/csharp/build/target.lua index 522ef05f0..689bbe6c5 100644 --- a/xmake/rules/csharp/build/target.lua +++ b/xmake/rules/csharp/build/target.lua @@ -42,14 +42,9 @@ function build_sourcefiles(target, sourcebatch, opt) local targetfile = target:targetfile() -- get source files and kind - local sourcefiles = table.copy(sourcebatch.sourcefiles) + local sourcefiles = sourcebatch.sourcefiles local sourcekind = sourcebatch.sourcekind - - -- prepend .csproj file so dotnet tool can find it - local csprojfile = _get_csprojfile(target) - if csprojfile then - table.insert(sourcefiles, 1, csprojfile) - end + local csprojfile = _get_csprojfile(target) -- get depend file local dependfile = target:dependfile(targetfile) @@ -84,7 +79,7 @@ function build_sourcefiles(target, sourcebatch, opt) -- update files and values to the dependent file dependinfo.values = depvalues - table.join2(dependinfo.files, sourcefiles) + table.join2(dependinfo.files, sourcefiles, csprojfile) depend.save(dependinfo, dependfile) end |
