From a0fd08ab27edb0bf518a409b8aae9ce6f1aaf51b Mon Sep 17 00:00:00 2001 From: Arthur Vasseur Date: Wed, 15 Apr 2026 20:21:52 +0200 Subject: vsxmake: generate .csproj for C# targets Detect targets whose source kinds are entirely "cs" and emit a .csproj --- tests/plugins/project/test.lua | 53 +++++++ xmake/plugins/project/vsxmake/getinfo.lua | 26 ++++ xmake/plugins/project/vsxmake/vsxmake.lua | 21 ++- xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets | 163 +++++++++++++++++++++ .../vsproj/templates/csproj/#target#.csproj | 50 +++++++ .../vsproj/templates/csproj/File.cs(filecs) | 1 + .../csproj/ProjectConfiguration(mode,arch) | 4 + .../vsproj/templates/csproj/ProjectRef(dep) | 3 + .../vsproj/templates/csproj/XmakeConfig(mode,arch) | 14 ++ .../vsproj/templates/csproj/XmakePath(mode,arch) | 7 + .../vsxmake/vsproj/templates/sln/Project(target) | 2 +- 11 files changed, 338 insertions(+), 6 deletions(-) create mode 100644 xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets create mode 100644 xmake/scripts/vsxmake/vsproj/templates/csproj/#target#.csproj create mode 100644 xmake/scripts/vsxmake/vsproj/templates/csproj/File.cs(filecs) create mode 100644 xmake/scripts/vsxmake/vsproj/templates/csproj/ProjectConfiguration(mode,arch) create mode 100644 xmake/scripts/vsxmake/vsproj/templates/csproj/ProjectRef(dep) create mode 100644 xmake/scripts/vsxmake/vsproj/templates/csproj/XmakeConfig(mode,arch) create mode 100644 xmake/scripts/vsxmake/vsproj/templates/csproj/XmakePath(mode,arch) diff --git a/tests/plugins/project/test.lua b/tests/plugins/project/test.lua index 168e71f1a..7de8835f1 100644 --- a/tests/plugins/project/test.lua +++ b/tests/plugins/project/test.lua @@ -2,6 +2,7 @@ import("core.project.config") import("core.platform.platform") import("core.tool.toolchain") import("lib.detect.find_tool") +import("detect.sdks.find_dotnet") function test_vsxmake(t) @@ -56,6 +57,58 @@ function test_vsxmake(t) os.tryrm(tempdir) end +function test_vsxmake_csharp(t) + + if not is_subhost("windows") then + return t:skip("wrong host platform") + end + + local dotnet = find_dotnet() + if not dotnet or not dotnet.sdkver then + return t:skip("dotnet sdk not found") + end + + local projname = "testcsproj" + local tempdir = os.tmpfile() + os.mkdir(tempdir) + os.cd(tempdir) + + -- create a C# console project using xmake create + os.vrunv("xmake", {"create", "-l", "csharp", "console", projname}) + os.cd(projname) + + -- create sln & csproj + local arch = os.getenv("platform") or "x64" + local vs = config.get("vs") + local vstype = "vsxmake" .. vs + os.execv("xmake", {"project", "-k", vstype, "-a", arch}) + os.cd(vstype) + + -- verify a .csproj was generated (not .vcxproj) + local csproj_path = path.join(projname, projname .. ".csproj") + assert(os.isfile(csproj_path), "expected .csproj to be generated at " .. csproj_path) + assert(not os.isfile(path.join(projname, projname .. ".vcxproj")), + "unexpected .vcxproj generated for C# target") + + -- verify .sln references the .csproj with the C# project type GUID + local sln_text = io.readfile(projname .. ".sln") + assert(sln_text:find("FAE04EC0-301F-11D3-BF4B-00C04F79EFBC", 1, true), + "C# project type GUID missing from .sln") + assert(sln_text:find(projname .. ".csproj", 1, true), + ".csproj reference missing from .sln") + + -- verify the .csproj imports Xmake.CSharp.targets and has a Compile item + local csproj_text = io.readfile(csproj_path) + assert(csproj_text:find("Xmake.CSharp.targets", 1, true), + "Xmake.CSharp.targets import missing from .csproj") + assert(csproj_text:find(" item missing from .csproj") + + -- clean up + os.cd(os.scriptdir()) + os.tryrm(tempdir) +end + function test_compile_commands(t) local projname = "testproj" local tempdir = os.tmpfile() diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua index 9395657fd..60b20b9c4 100644 --- a/xmake/plugins/project/vsxmake/getinfo.lua +++ b/xmake/plugins/project/vsxmake/getinfo.lua @@ -89,6 +89,20 @@ function _make_arrs(arr, sep) return table.concat(r, sep or ";") end +-- detect project kind (csharp vs cxx) so vsxmake emits .csproj for C# targets +function _get_projkind(target) + local sourcekinds = table.wrap(target:sourcekinds()) + if #sourcekinds == 0 then + return "cxx" + end + for _, sk in ipairs(sourcekinds) do + if sk ~= "cs" then + return "cxx" + end + end + return "csharp" +end + -- get values from target function _get_values_from_target(target, name) local values = {} @@ -122,6 +136,7 @@ function _make_targetinfo(mode, arch, target) -- save target kind targetinfo.kind = target:kind() + targetinfo.projkind = _get_projkind(target) -- is default? targetinfo.default = tostring(target:is_default()) @@ -497,6 +512,17 @@ function main(outputdir, vsinfo) _target.vcxprojdir_relative_sln = vsutils.translate_path(path.relative(_target.vcxprojdir, vsinfo.solution_dir)) _target.target_id = hash.uuid4(targetname) _target.kind = target:kind() + if not _target.projkind then + _target.projkind = _get_projkind(target) + if _target.projkind == "csharp" then + -- C# project type GUID, see https://www.codeproject.com/Reference/720512/List-of-Visual-Studio-Project-Type-GUIDs + _target.projtypeguid = "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC" + _target.projext = "csproj" + else + _target.projtypeguid = "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942" + _target.projext = "vcxproj" + end + end _target.absscriptdir = target:scriptdir() _target.scriptdir = path.relative(target:scriptdir(), _target.vcxprojdir) _target.projectdir = path.relative(project.directory(), _target.vcxprojdir) diff --git a/xmake/plugins/project/vsxmake/vsxmake.lua b/xmake/plugins/project/vsxmake/vsxmake.lua index b52b160a9..cd61dfcbf 100644 --- a/xmake/plugins/project/vsxmake/vsxmake.lua +++ b/xmake/plugins/project/vsxmake/vsxmake.lua @@ -31,6 +31,7 @@ import("vstudio.impl.vsutils", {rootdir = path.join(os.programdir(), "plugins", local template_root = path.join(os.programdir(), "scripts", "vsxmake", "vsproj", "templates") local template_sln = path.join(template_root, "sln", "vsxmake.sln") local template_vcx = path.join(template_root, "vcxproj", "#target#.vcxproj") +local template_csproj = path.join(template_root, "csproj", "#target#.csproj") local template_fil = path.join(template_root, "vcxproj.filters", "#target#.vcxproj.filters") local template_props = path.join(template_root, "Xmake.Custom.props") @@ -146,6 +147,9 @@ function _buildparams(info, target, default) elseif args.filets then -- for qt/.ts local files = info._targets[target].sourcefiles table.insert(r, _filter_files(files, {".ts"})) + elseif args.filecs then -- for c# + local files = info._targets[target].sourcefiles + table.insert(r, _filter_files(files, {".cs"})) elseif args.incc then local files = table.join(info._targets[target].headerfiles or {}, info._targets[target].extrafiles) table.insert(r, _filter_files(files, nil, {".natvis"})) @@ -239,14 +243,21 @@ function make(version) for _, target in ipairs(info.targets) do local paramsprovidertarget = _buildparams(info, target, "") - local vcxproj_dir = info._targets[target].vcxprojdir + local _target = info._targets[target] + local vcxproj_dir = _target.vcxprojdir + local projkind = _target.projkind or "cxx" + local projext = _target.projext or "vcxproj" -- write project file - local vcxproj_file = path.join(vcxproj_dir, target .. ".vcxproj") - _writefileifneeded(vcxproj_file, render(template_vcx, "#([A-Za-z0-9_,%.%*%(%)]+)#", "@([^@]+)@", paramsprovidertarget)) + local proj_file = path.join(vcxproj_dir, target .. "." .. projext) + local proj_template = (projkind == "csharp") and template_csproj or template_vcx + _writefileifneeded(proj_file, render(proj_template, "#([A-Za-z0-9_,%.%*%(%)]+)#", "@([^@]+)@", paramsprovidertarget)) - local vcxproj_filters = path.join(vcxproj_dir, target .. ".vcxproj.filters") - _writefileifneeded(vcxproj_filters, render(template_fil, "#([A-Za-z0-9_,%.%*%(%)]+)#", "@([^@]+)@", paramsprovidertarget)) + -- .csproj does not use a .filters sidecar (legacy .vcxproj-only mechanism) + if projkind ~= "csharp" then + local vcxproj_filters = path.join(vcxproj_dir, target .. ".vcxproj.filters") + _writefileifneeded(vcxproj_filters, render(template_fil, "#([A-Za-z0-9_,%.%*%(%)]+)#", "@([^@]+)@", paramsprovidertarget)) + end -- add project custom file _trycp(template_props, vcxproj_dir) diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets b/xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets new file mode 100644 index 000000000..5c8825452 --- /dev/null +++ b/xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets @@ -0,0 +1,163 @@ + + + + + + + $(XmakeBuilDDir) + $(XmakeTargetDir) + $(XmakeConfigDir) + $(XmakeConfigFileDir) + $(XmakeRunDir) + + + $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeBuilDDirResolved)')) + $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeTargetDirResolved)')) + $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigDirResolved)')) + $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigFileDirResolved)')) + $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeRunDirResolved)')) + + + $([System.IO.Path]::GetFullPath('$(XmakeBuilDDirResolved)/')) + $([System.IO.Path]::GetFullPath('$(XmakeTargetDirResolved)/')) + $([System.IO.Path]::GetFullPath('$(XmakeConfigDirResolved)/')) + $([System.IO.Path]::GetFullPath('$(XmakeConfigFileDirResolved)/')) + $([System.IO.Path]::GetFullPath('$(XmakeRunDirResolved)/')) + + + $([System.IO.Path]::GetFullPath('$(XmakeProgramDir)/')) + $([System.IO.Path]::GetFullPath('$(XmakeProgramFile)')) + $([System.IO.Path]::GetFullPath('$(XmakeProjectDir)/')) + $([System.IO.Path]::GetFullPath('$(XmakeScriptDir)/')) + + + + <_XmakeProjectFlag Condition="'$(XmakeProjectFile)' != ''">-F "$(XmakeProjectFile)" + <_XmakeProjectFlag Condition="'$(XmakeProjectFile)' == ''">-P . + + <_XmakeCommonFlags>$(XmakeCommonFlags.Trim()) + <_XmakeCommonFlags Condition="$(XmakeVerbose)">-v $(_XmakeCommonFlags.Trim()) + <_XmakeCommonFlags Condition="$(XmakeDiagnosis)">-D $(_XmakeCommonFlags.Trim()) + <_XmakeCommonFlags>-y $(_XmakeCommonFlags.Trim()) $(_XmakeProjectFlag) + + <_XmakeOutFlag>-o "$([MSBuild]::MakeRelative('$(XmakeProjectDirResolved)', '$(XmakeBuilDDirResolved)').TrimEnd('\').TrimEnd('/'))" + + <_XmakeConfigFlags>$(XmakeConfigFlags.Trim()) + <_XmakeConfigFlags>-p $(XmakePlat) -m $(XmakeMode) -a $(XmakeArch) $(_XmakeOutFlag) $(_XmakeConfigFlags.Trim()) + + <_XmakeBuildFileFlags>$(_XmakeBuildFlags.Trim()) + <_XmakeBuildFileFlags Condition="$(XmakeRebuildFile)">$(_XmakeBuildFileFlags.Trim()) -r + + <_XmakeCleanFlags>$(XmakeCleanFlags.Trim()) + <_XmakeCleanFlags Condition="$(XmakeCleanAll)">-a $(_XmakeCleanFlags.Trim()) + + <_XmakeBuildFlags>$(_XmakeBuildFlags.Trim()) + <_XmakeBuildFileFlags>$(_XmakeBuildFileFlags.Trim()) + <_XmakeCleanFlags>$(_XmakeCleanFlags.Trim()) + <_XmakeConfigFlags>$(_XmakeConfigFlags.Trim()) + <_XmakeCommonFlags>$(_XmakeCommonFlags.Trim()) + <_XmakeTarget>"$(XmakeTarget.Trim())" + + <_XmakeExecutable>"$([System.IO.Path]::GetFullPath('$(XmakeProgramFileResolved)'))" + <_XmakeEnv> + pushd $(XmakeProjectDirResolved) + set XMAKE_CONFIGDIR=$(XmakeConfigDirResolved.TrimEnd('\').TrimEnd('/')) + set XMAKE_PROGRAM_DIR=$(XmakeProgramDirResolved.TrimEnd('\').TrimEnd('/')) + set XMAKE_PROGRAM_FILE=$(XmakeProgramFileResolved.TrimEnd('\').TrimEnd('/')) + set XMAKE_SKIP_HISTORY=1 + set XMAKE_IN_VSTUDIO=1 + + <_XmakeEnv Condition="$(XmakeDiagnosis)"> + $(_XmakeEnv) + echo XMAKE_CONFIGDIR=%25XMAKE_CONFIGDIR%25 + echo XMAKE_PROGRAM_DIR=%25XMAKE_PROGRAM_DIR%25 + echo XMAKE_PROGRAM_FILE=%25XMAKE_PROGRAM_FILE%25 + echo CD=%25CD%25 + + + + + + + + + + + + + + + + + + + + + + + + + + + --files="@(File)" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xmake/scripts/vsxmake/vsproj/templates/csproj/#target#.csproj b/xmake/scripts/vsxmake/vsproj/templates/csproj/#target#.csproj new file mode 100644 index 000000000..7074a136d --- /dev/null +++ b/xmake/scripts/vsxmake/vsproj/templates/csproj/#target#.csproj @@ -0,0 +1,50 @@ + + + + +#Import(ProjectConfiguration)# + + + {#target_id#} + release + AnyCPU + #scriptdir# + #projectdir# + #projectfile# + #targetname# + + + $(XMAKE_PROGRAM_DIR) + #programdir# + $(XMAKE_PROGRAM_FILE) + #programfile# + + +#Import(XmakeConfig)# +#Import(XmakePath)# + + Exe + Library + Library + Library + $(XmakeBasename) + #targetname# + Properties + 512 + + +#Import(File.cs)# + + + + diff --git a/xmake/scripts/vsxmake/vsproj/templates/csproj/File.cs(filecs) b/xmake/scripts/vsxmake/vsproj/templates/csproj/File.cs(filecs) new file mode 100644 index 000000000..f1f9c063a --- /dev/null +++ b/xmake/scripts/vsxmake/vsproj/templates/csproj/File.cs(filecs) @@ -0,0 +1 @@ + diff --git a/xmake/scripts/vsxmake/vsproj/templates/csproj/ProjectConfiguration(mode,arch) b/xmake/scripts/vsxmake/vsproj/templates/csproj/ProjectConfiguration(mode,arch) new file mode 100644 index 000000000..d6956bf15 --- /dev/null +++ b/xmake/scripts/vsxmake/vsproj/templates/csproj/ProjectConfiguration(mode,arch) @@ -0,0 +1,4 @@ + + #mode# + #vsarch# + diff --git a/xmake/scripts/vsxmake/vsproj/templates/csproj/ProjectRef(dep) b/xmake/scripts/vsxmake/vsproj/templates/csproj/ProjectRef(dep) new file mode 100644 index 000000000..88c9645b2 --- /dev/null +++ b/xmake/scripts/vsxmake/vsproj/templates/csproj/ProjectRef(dep) @@ -0,0 +1,3 @@ + + {#target_id#} + diff --git a/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakeConfig(mode,arch) b/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakeConfig(mode,arch) new file mode 100644 index 000000000..864300fd7 --- /dev/null +++ b/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakeConfig(mode,arch) @@ -0,0 +1,14 @@ + + #basename# + #filename# + #mode# + #plat# + #arch# + #kind# + #default# + #defines# + #languages# + #runenvs# + #runargs# + #configflags# + diff --git a/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakePath(mode,arch) b/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakePath(mode,arch) new file mode 100644 index 000000000..f724ee28c --- /dev/null +++ b/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakePath(mode,arch) @@ -0,0 +1,7 @@ + + #builddir# + #configdir# + #configfiledir# + #targetdir# + #rundir# + diff --git a/xmake/scripts/vsxmake/vsproj/templates/sln/Project(target) b/xmake/scripts/vsxmake/vsproj/templates/sln/Project(target) index e53697651..96fa75078 100644 --- a/xmake/scripts/vsxmake/vsproj/templates/sln/Project(target) +++ b/xmake/scripts/vsxmake/vsproj/templates/sln/Project(target) @@ -1,2 +1,2 @@ -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "#targetname#", "#vcxprojdir_relative_sln#\#targetname_inpath#.vcxproj", "{#target_id#}" +Project("{#projtypeguid#}") = "#targetname#", "#vcxprojdir_relative_sln#\#targetname_inpath#.#projext#", "{#target_id#}" EndProject -- cgit v1.3.1 From 1d43868f83b094a3c8a22f83233bb0f7efbd4f24 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 18 Apr 2026 20:40:39 +0800 Subject: fix review issues --- tests/plugins/project/test.lua | 2 +- xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets | 10 +++++----- xmake/scripts/vsxmake/vsproj/Xmake.props | 8 ++++---- xmake/scripts/vsxmake/vsproj/Xmake.targets | 14 +++++++------- xmake/scripts/vsxmake/vsproj/Xmake.xml | 2 +- xmake/scripts/vsxmake/vsproj/templates/Xmake.Custom.props | 2 +- .../vsxmake/vsproj/templates/csproj/XmakePath(mode,arch) | 2 +- .../vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/plugins/project/test.lua b/tests/plugins/project/test.lua index 7de8835f1..40edd6a3a 100644 --- a/tests/plugins/project/test.lua +++ b/tests/plugins/project/test.lua @@ -74,7 +74,7 @@ function test_vsxmake_csharp(t) os.cd(tempdir) -- create a C# console project using xmake create - os.vrunv("xmake", {"create", "-l", "csharp", "console", projname}) + os.vrunv("xmake", {"create", "-l", "csharp", "-t", "console", projname}) os.cd(projname) -- create sln & csproj diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets b/xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets index 5c8825452..1b18b3a0c 100644 --- a/xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets +++ b/xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets @@ -4,21 +4,21 @@ - $(XmakeBuilDDir) + $(XmakeBuildDir) $(XmakeTargetDir) $(XmakeConfigDir) $(XmakeConfigFileDir) $(XmakeRunDir) - $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeBuilDDirResolved)')) + $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeBuildDirResolved)')) $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeTargetDirResolved)')) $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigDirResolved)')) $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigFileDirResolved)')) $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeRunDirResolved)')) - $([System.IO.Path]::GetFullPath('$(XmakeBuilDDirResolved)/')) + $([System.IO.Path]::GetFullPath('$(XmakeBuildDirResolved)/')) $([System.IO.Path]::GetFullPath('$(XmakeTargetDirResolved)/')) $([System.IO.Path]::GetFullPath('$(XmakeConfigDirResolved)/')) $([System.IO.Path]::GetFullPath('$(XmakeConfigFileDirResolved)/')) @@ -40,12 +40,12 @@ <_XmakeCommonFlags Condition="$(XmakeDiagnosis)">-D $(_XmakeCommonFlags.Trim()) <_XmakeCommonFlags>-y $(_XmakeCommonFlags.Trim()) $(_XmakeProjectFlag) - <_XmakeOutFlag>-o "$([MSBuild]::MakeRelative('$(XmakeProjectDirResolved)', '$(XmakeBuilDDirResolved)').TrimEnd('\').TrimEnd('/'))" + <_XmakeOutFlag>-o "$([MSBuild]::MakeRelative('$(XmakeProjectDirResolved)', '$(XmakeBuildDirResolved)').TrimEnd('\').TrimEnd('/'))" <_XmakeConfigFlags>$(XmakeConfigFlags.Trim()) <_XmakeConfigFlags>-p $(XmakePlat) -m $(XmakeMode) -a $(XmakeArch) $(_XmakeOutFlag) $(_XmakeConfigFlags.Trim()) - <_XmakeBuildFileFlags>$(_XmakeBuildFlags.Trim()) + <_XmakeBuildFileFlags>$(XmakeBuildFlags.Trim()) <_XmakeBuildFileFlags Condition="$(XmakeRebuildFile)">$(_XmakeBuildFileFlags.Trim()) -r <_XmakeCleanFlags>$(XmakeCleanFlags.Trim()) diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.props b/xmake/scripts/vsxmake/vsproj/Xmake.props index e2bf58dfe..6bde5d90a 100644 --- a/xmake/scripts/vsxmake/vsproj/Xmake.props +++ b/xmake/scripts/vsxmake/vsproj/Xmake.props @@ -29,9 +29,9 @@ - $(XmakeProjectDir)\build - $(XmakeBuilDDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode) - $(XmakeBuilDDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode) + $(XmakeProjectDir)\build + $(XmakeBuildDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode) + $(XmakeBuildDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode) $(XMAKE_CONFIGDIR) $(XmakeProjectDir) @@ -171,7 +171,7 @@ $(XmakeLinkDirs);$(LibraryPath) $(XmakeTargetDir)\ - $(XmakeBuilDDir)\.vs\$(TargetName)\$(XmakeArch)\$(XmakeMode)\ + $(XmakeBuildDir)\.vs\$(TargetName)\$(XmakeArch)\$(XmakeMode)\ $(XmakeSourceDirs);$(SourcePath) diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.targets b/xmake/scripts/vsxmake/vsproj/Xmake.targets index ec7ea3532..b95f3e0ba 100644 --- a/xmake/scripts/vsxmake/vsproj/Xmake.targets +++ b/xmake/scripts/vsxmake/vsproj/Xmake.targets @@ -8,21 +8,21 @@ - $(XmakeBuilDDir) + $(XmakeBuildDir) $(XmakeTargetDir) $(XmakeConfigDir) $(XmakeConfigFileDir) $(XmakeRunDir) - $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeBuilDDirResolved)')) + $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeBuildDirResolved)')) $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeTargetDirResolved)')) $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigDirResolved)')) $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigFileDirResolved)')) $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeRunDirResolved)')) - $([System.IO.Path]::GetFullPath('$(XmakeBuilDDirResolved)/')) + $([System.IO.Path]::GetFullPath('$(XmakeBuildDirResolved)/')) $([System.IO.Path]::GetFullPath('$(XmakeTargetDirResolved)/')) $([System.IO.Path]::GetFullPath('$(XmakeConfigDirResolved)/')) $([System.IO.Path]::GetFullPath('$(XmakeConfigFileDirResolved)/')) @@ -44,12 +44,12 @@ <_XmakeCommonFlags Condition="$(XmakeDiagnosis)">-D $(_XmakeCommonFlags.Trim()) <_XmakeCommonFlags>-y $(_XmakeCommonFlags.Trim()) $(_XmakeProjectFlag) - <_XmakeOutFlag>-o "$([MSBuild]::MakeRelative('$(XmakeProjectDirResolved)', '$(XmakeBuilDDirResolved)').TrimEnd('\').TrimEnd('/'))" + <_XmakeOutFlag>-o "$([MSBuild]::MakeRelative('$(XmakeProjectDirResolved)', '$(XmakeBuildDirResolved)').TrimEnd('\').TrimEnd('/'))" <_XmakeConfigFlags>$(XmakeConfigFlags.Trim()) <_XmakeConfigFlags>-p $(XmakePlat) -m $(XmakeMode) -a $(XmakeArch) $(_XmakeOutFlag) $(_XmakeConfigFlags.Trim()) - <_XmakeBuildFileFlags>$(_XmakeBuildFlags.Trim()) + <_XmakeBuildFileFlags>$(XmakeBuildFlags.Trim()) <_XmakeBuildFileFlags Condition="$(XmakeRebuildFile)">$(_XmakeBuildFileFlags.Trim()) -r <_XmakeCleanFlags>$(XmakeCleanFlags.Trim()) @@ -156,7 +156,7 @@ MSBuild Properties: XmakeProgramFile: $(XmakeProgramFile) XmakeProjectDir: $(XmakeProjectDir) XmakeScriptDir: $(XmakeScriptDir) - XmakeBuilDDir: $(XmakeBuilDDir) + XmakeBuildDir: $(XmakeBuildDir) XmakeTargetDir: $(XmakeTargetDir) XmakeConfigDir: $(XmakeConfigDir) XmakeConfigFileDir: $(XmakeConfigFileDir) @@ -166,7 +166,7 @@ MSBuild Properties: XmakeProgramFile: $(XmakeProgramFileResolved) XmakeProjectDir: $(XmakeProjectDirResolved) XmakeScriptDir: $(XmakeScriptDirResolved) - XmakeBuilDDir: $(XmakeBuilDDirResolved) + XmakeBuildDir: $(XmakeBuildDirResolved) XmakeTargetDir: $(XmakeTargetDirResolved) XmakeConfigDir: $(XmakeConfigDirResolved) XmakeConfigFileDir: $(XmakeConfigFileDirResolved) diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.xml b/xmake/scripts/vsxmake/vsproj/Xmake.xml index 3f5600ba6..9bccf1b28 100644 --- a/xmake/scripts/vsxmake/vsproj/Xmake.xml +++ b/xmake/scripts/vsxmake/vsproj/Xmake.xml @@ -66,7 +66,7 @@ Description="Set environment XMAKE_CONFIGDIR for xmake tasks" Subtype="folder" /> $(XmakeProjectDir)\.xmake --> - + diff --git a/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakePath(mode,arch) b/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakePath(mode,arch) index f724ee28c..7e423ee00 100644 --- a/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakePath(mode,arch) +++ b/xmake/scripts/vsxmake/vsproj/templates/csproj/XmakePath(mode,arch) @@ -1,5 +1,5 @@ - #builddir# + #builddir# #configdir# #configfiledir# #targetdir# diff --git a/xmake/scripts/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) b/xmake/scripts/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) index f724ee28c..7e423ee00 100644 --- a/xmake/scripts/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) +++ b/xmake/scripts/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) @@ -1,5 +1,5 @@ - #builddir# + #builddir# #configdir# #configfiledir# #targetdir# -- cgit v1.3.1 From 839a0b74facd029e4b13aa2a6657abfdaa445964 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 18 Apr 2026 20:51:17 +0800 Subject: fix some flags issues --- xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets | 4 +++- xmake/scripts/vsxmake/vsproj/Xmake.targets | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets b/xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets index 1b18b3a0c..2ac8336f5 100644 --- a/xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets +++ b/xmake/scripts/vsxmake/vsproj/Xmake.CSharp.targets @@ -45,7 +45,9 @@ <_XmakeConfigFlags>$(XmakeConfigFlags.Trim()) <_XmakeConfigFlags>-p $(XmakePlat) -m $(XmakeMode) -a $(XmakeArch) $(_XmakeOutFlag) $(_XmakeConfigFlags.Trim()) - <_XmakeBuildFileFlags>$(XmakeBuildFlags.Trim()) + <_XmakeBuildFlags>$(XmakeBuildFlags.Trim()) + + <_XmakeBuildFileFlags>$(_XmakeBuildFlags.Trim()) <_XmakeBuildFileFlags Condition="$(XmakeRebuildFile)">$(_XmakeBuildFileFlags.Trim()) -r <_XmakeCleanFlags>$(XmakeCleanFlags.Trim()) diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.targets b/xmake/scripts/vsxmake/vsproj/Xmake.targets index b95f3e0ba..e789e7862 100644 --- a/xmake/scripts/vsxmake/vsproj/Xmake.targets +++ b/xmake/scripts/vsxmake/vsproj/Xmake.targets @@ -49,7 +49,9 @@ <_XmakeConfigFlags>$(XmakeConfigFlags.Trim()) <_XmakeConfigFlags>-p $(XmakePlat) -m $(XmakeMode) -a $(XmakeArch) $(_XmakeOutFlag) $(_XmakeConfigFlags.Trim()) - <_XmakeBuildFileFlags>$(XmakeBuildFlags.Trim()) + <_XmakeBuildFlags>$(XmakeBuildFlags.Trim()) + + <_XmakeBuildFileFlags>$(_XmakeBuildFlags.Trim()) <_XmakeBuildFileFlags Condition="$(XmakeRebuildFile)">$(_XmakeBuildFileFlags.Trim()) -r <_XmakeCleanFlags>$(XmakeCleanFlags.Trim()) -- cgit v1.3.1