在旧版本的 csproj 格式也就是 Franken-proj 格式,可以使用 SolutionDir 拿到当前sln文件所在的文件夹,但是在 SDK Style 格式的项目文件,是拿不到这个属性的,本文告诉大家如何做到兼容之前的逻辑 " AfterTargets="BeforeBuild"> <Warning Text="Solution $(<em>SolutionDir</em>)"/> </Target> 如果我使用 dotnet 命令构建 sln 文件,那么可以输出 sln 所在的文件夹 这就是不同点 但是如果我只是想通过 dotnet 或 msbuild 命令构建 csproj 文件,而不构建 sln 文件,此时还需要使用 SolutionDir 那么请在 sln 文件夹添加一个叫 Directory.Build.props 文件,这个文件可以设置这个文件夹里面的所有项目的构建 而 $(SolutionDir) 属性的含义也就是一个属性,因此只需要返回当前 sln 所在文件夹就可以 <Project> <PropertyGroup> <SolutionDir>$(MSBuildThisFileDirectory)</PackageOutputPath
我找了很久没有发现 SolutionDir 这个定义,所以只能通过一个不通用的方法找到 在之前的项目可以使用 PreBuildEvent 的方式指定编译之前事件,新的项目格式也可以支持这个方法,只是支持不是很好 我就遇到在 Jenkins 无法编译通过,因为 PreBuildEvent 指定的 $(SolutionDir) 是空 在新的项目格式,找了很久都没有找到 $(SolutionDir) 的定义和找到运行的 README.md | \---src lindexi.csproj 在 Directory.Build.props 添加下面代码 <Project> <PropertyGroup> <SolutionDir >$(MSBuildThisFileDirectory)</SolutionDir> </PropertyGroup> </Project> 因为 $(MSBuildThisFileDirectory
Title Command Arguments Initial directory 在此仓库运行 Git Bash C:\Program Files\Git\git-bash.exe "--cd=$(SolutionDir "$(SolutionDir)/.." 在资源管理器中打开仓库 C:\Windows\explorer.exe /select,"$(SolutionDir)\." "$(SolutionDir)\."
前言 最近客户反馈,为啥不用xcopy命令代替我自己写的命令来完成插件编译复制: 我的: <PostBuildEvent>call "$(SolutionDir)tools\tools\Magicodes.CmdTools.exe " copy -s "$(SolutionDir)plus\Jxy.WeChat\Jxy.WeChat.Core\bin\Debug\net461\Jxy.WeChat.Core.dll" -t "$( SolutionDir)src\Magicodes.Admin.Web.Mvc\wwwroot\PlugIns"</PostBuildEvent> <RunPostBuildEvent>OnBuildSuccess </RunPostBuildEvent> 推荐的: call xcopy /s /y "$(TargetPath)" "$(SolutionDir)src\ Magicodes.Admin.Web.Mvc <PropertyGroup> <PostBuildEvent> echo 准备复制"$(TargetPath)" call xcopy /s /y "$(TargetPath)" "$(SolutionDir
以便快速输入 git 命令 [Title] 打开 Git Bash [Command] C:\Program Files\Git\git-bash.exe [Arguments] --cd="$(SolutionDir [InitialDirectory] "$(SolutionDir)" 用于快速打开解决方案所在的文件夹(通常这也是 git 仓库的根目录) [Title] 在资源管理器中查看此解决方案 [Command ] C:\Windows\explorer.exe [Arguments] /select,"$(SolutionDir)$(SolutionFileName)" [InitialDirectory] "$(SolutionDir)" 用于快速打开当前正在编辑的文件所在的文件夹 [Title] 在资源管理器中查看此文件 [Command] C:\Windows\explorer.exe [Arguments )" [InitialDirectory] "$(SolutionDir)" 使用 TortoiseGit 来 Blame 此文件(而且还会自动定位到当前行) [Title] 追溯此文件 [Command
)dynasm/dynasm.lua -LN -D WIN -D JIT -D FFI -o $(SolutionDir)Buildvm/buildvm_arch.h archdasc/vm_x86.dasc 在工程设置中设置C\C++->General->Additional Include Directories为"$(SolutionDir)Lj";"$(SolutionDir)Header"。 -o $(SolutionDir)Builvmheader\lj_libdef.h %ALL_LIB% $(OutDir)\buildvm.exe -m recdef -o $(SolutionDir 在C\C++->General->Additional Include Directories设置"$(SolutionDir)Header";"$(SolutionDir)OtherHeader";" $(SolutionDir)Lj";"$(SolutionDir)Builvmheader";"$(SolutionDir)OtherLualib";"$(SolutionDir)Lualib"。
如果你看过我上一篇文章,你应该知道我们至少具有解决T4模板的程序集引用的五种方案,在这里我们采用的是VS宏的解决方案,即将引用程序集文件的路径设置成通过$(SolutionDir)表示的解决方案目录的相对路径 HelloWorld.tt定义如下,引用的程序集路径为Lib项目在Debug模式下编译生成的目录($(SolutionDir)Lib\Bin\Debug\)。 <#@ template debug="true" hostSpecific="true" #> <#@ output extension=".cs" #> <#@ Assembly name="$(<em>SolutionDir</em> @ VolatileAssembly…#>(<#@ VolatileAssembly processor="T4Toolbox.VolatileAssemblyProcessor" name="$(<em>SolutionDir</em> output extension=".cs" #> <#@ VolatileAssembly processor="T4Toolbox.VolatileAssemblyProcessor" name="$(<em>SolutionDir</em>
开关 略(见原文) 示例 MSBuild.exe MyProject.proj -t:rebuild 问题 1、VS 中的生成前事件中参数未被识别的问题 项目中有如下生成事件,其中使用了 $(SolutionDir ) 参数: 在使用 Jenkins 的 MSBuild 插件进行编译项目时发现该命令不能被识别: 参考《[使用 MSBuild Tools 调用 csproj 项目文件发布网站时 $(SolutionDir ) 宏参数值丢失为空的解决方案](https://www.cnblogs.com/VAllen/p/how-to-get-rid-of-solutiondir-when-building-vs-project-from-outside-visual.html )》可知,可以使用 -p 开关来指定参数的值,如下: MSBuild D:JenkinsDataworkspaceSrcdesktop.sln -p:SolutionDir=D:JenkinsDataworkspaceSrc DEBUG /project %desktop_dir%UIMain.Gui.csproj MSBuild %desktop_dir%UIMain.Gui.csproj -p:WarningLevel=0;SolutionDir
生成目录:$(SolutionDir)bin$(Platform)$(Configuration) 缓存目录:$(SolutionDir)tmp$(Platform)$(Configuration)$(
如: Terminal window xcopy /E /Y $(SolutionDir)_Externals\Refs\LiteDB.2.0.2.0\*.dll $(OutDir)LiteDB.2.0.2.0 \xcopy /E /Y $(SolutionDir)_Externals\Refs\LiteDB.4.0.0.0\*.dll $(OutDir)LiteDB.4.0.0.0\ 这样,不仅可以将 dll
Debug下的mysqlpp_d.lib mysqlpp_d.dll拷贝到上述lib文件夹中 g、通过和3步骤一样的方法将工程下的include、lib这两个路径添加到工程属性中(可以使用(SolutionDir )\include、(SolutionDir)\lib) h、将libmysql.lib mysqlpp_d.lib 添加到引用库 i、编译运行,报错没有libmysql.dll、 mysqlpp_d.dll这两个库,将$(SolutionDir)\lib中的这两个库拷贝到Debug目录下就行了。
Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir
本文告诉大家如何使用 WriteLinesToFile 先把参数写入文件,通过文件的方式传输参数 Roslyn 获得 sln 文件所在的文件夹 我找了很久没有发现 SolutionDir 这个定义,所以只能通过一个不通用的方法找到 在之前的项目可以使用 PreBuildEvent 的方式指定编译之前事件,新的项目格式也可以支持这个方法,只是支持不是很好 我就遇到在 Jenkins 无法编译通过,因为 PreBuildEvent 指定的 $(SolutionDir ) 是空 在新的项目格式,找了很久都没有找到 $(SolutionDir) 的定义和找到运行的 sln 文件的定义的方法 于是通过 Directory.Build.props 的方法找到 sln 文件 README.md | \---src lindexi.csproj 在 Directory.Build.props 添加下面代码 <Project> <PropertyGroup> <SolutionDir >$(MSBuildThisFileDirectory)</SolutionDir> </PropertyGroup> </Project> 因为 $(MSBuildThisFileDirectory
设置项目主程序生成后事件 参考命令: IF "$(ConfigurationName)" == "Release" ( "$(SolutionDir)DevOps\InnoSetup\ISCC.exe " "$(SolutionDir)DevOps\InnoSetup\KJTStep.iss" start explorer /select,"$(SolutionDir)DevOps\Publish
版本为vs2023.输出目录:如果我们建立一个默认的vc项目Test1,他的默认“常规“栏目中,“输出目录”为$(SolutionDir)$(ConfigurationName),所以调试时会在解决方案文件夹下建立一个 $(SolutionDir):解决方案名,即.sln所在路径$(Platform):解决方案平台名称,如x86、x64$(Configuration):当前的编译配置名称,如Release、Debug$
--复制程序集--> <File Id="VSPackage1" Source="$(var.<em>SolutionDir</em>)\VSPackage1\ Value="[#VSPackage1]" Type="string" /> 也就是把CodeBase的Value改为 <File Id="VSPackage1" Source="$(var.<em>SolutionDir</em> --复制程序集--> <File Id="VSPackage1" Source="$(var.<em>SolutionDir</em>)\VSPackage1\
输入 $(SolutionDir)\bin\ 时,可以使得运行该项目以后生成的文件(pdb文件,ilk文件,exe文件等)会转存到解决方案下的bin目录里(如果目录不存在,将会被新建) 下面几个参数的含义
比如我们的Artech.T4AssemblyRefResovle.Foo.dll保存在当前解决方案目录的Lib子目录下,该程序集的路径就可以表示成:$(SolutionDir)\Lib\Artech.T4AssemblyRefResovle.Foo.dll <#@ template debug="false" hostspecific="false" language="C#" #> <#@ assembly name="$(<em>SolutionDir</em>)\Lib
Functions中设置导出函数名ExcuteLuaString 在C\C++->General->Additional Include Directories中设置我们要引入的头文件目录 "$(SolutionDir )Header";"$(SolutionDir)OtherHeader" 其他和LualibProject一样。
LibZ.Bootstrap Install-Package LibZ.Bootstrap -Version 1.2.0 然后,配置Post buid 脚本(生成后时间命令行): set LIBZ=$(SolutionDir