天道酬勤,学无止境

post-build-event

如何从 $(ProjectDir) 中删除跟踪反斜杠?(How can I remove tralling backslash from $(ProjectDir)?)

问题 我的构建后事件中有一个这样的命令行: aspnet_regiis -pef connectionStrings "$(ProjectDir)" -prov "DataProtectionConfigurationProvider" 但是aspnet_regiis正在返回失败,因为目录中的跟踪\ 。 传递全名,路径 + web.config 也不起作用。 我该如何解决这个问题? 回答1 您可以使用 TrimEnd 函数来修剪尾部斜杠字符 $(ProjectDir.TrimEnd('\')) 我在这篇文章中找到了这个选项

2021-11-30 07:20:23    分类:技术分享    .net   windows   visual-studio-2013   post-build-event

Run batch script before Debugging

I want to run a batch script every time before starting program for debugging. For the build events, such functionality is realized using pre-build event, post-build event. For actual debugging, I could not find any pre-Debug, post-Debug events. How to realize this scenario? I am using VS2008, .net framework 3.5, c# application. I am opposed to idea of creating some extra lines of code within the application that would fire-up external batch file.

2021-11-28 06:50:25    分类:问答    c#   .net   visual-studio-2008   post-build-event   pre-build-event

Updating local nuget package on post-build event

I have my local nuget library repository separately both for my personal and work releted class libraries. I have created some of the nuget packages for the libraries which are no longer in development. I did this only for them because I do not know how to update them automatically as soon as my project builds. I have figured that all the work is being done by nuget command line with Visual Studio Command Prompt. So I can easily do the work I needed (of course I would know commands perfectly and I do not !) Basically I want the following tasks to execute on the post-build event of my project

2021-11-28 06:21:11    分类:问答    c#   asp.net   visual-studio   nuget   post-build-event

How to get version number in post-build event

I want to use post-build event to automatically create a nuget package and then copy it to a shared folder on our network, something like this (the version number 1.0.0.0. is specified inside the MyLib.nuspec file): nuget.exe pack "$(SolutionDir)MyLib.nuspec" xcopy /Y "$(TargetDir)MyLib.1.0.0.0.nupkg" \\folder\subfolder\NuGetPackages This works, but now I would like to update this script, so that it would include the assembly version also, but I cannot get assembly version inside the post-build event. I would need something like this: nuget.exe pack -Version $(AssemblyVersion) "$(SolutionDir

2021-11-27 16:06:59    分类:问答    .net   visual-studio-2010   .net-4.0   post-build-event   assemblyversions

MSBuild AfterBuild Step

I have added the following code to a VisualC++ 2010 .vcxproj file just inside the first <project> tag: <PropertyGroup> <PilotStationDirectory>\..\..\PilotStation\PilotStationApp\$(Configuration)</PilotStationDirectory> </PropertyGroup> <ItemGroup> <MySourceFiles Include="$(TargetName).dll;$(TargetName).lib;$(TargetName).pdb" /> </ItemGroup> <Target Name="AfterBuild"> <MakeDir Directories="$(PilotStationDirectory)" /> <Copy SourceFiles="@(MySourceFiles)" DestinationFolder="$(PilotStationDirectory)" /> <Message Text="###I AM HERE###" /> </Target> I have set the "MSBuild project build output/log

2021-11-26 17:05:33    分类:问答    c++   visual-c++   msbuild   msbuild-task   post-build-event

用于发布的构建后事件命令 (Visual Studio 2010)(Post-build event command for publish (Visual Studio 2010))

问题 我在 Visual Studio 2010 中有一个项目。该项目具有以下构建后事件命令行: SET TARGET_PROJECT=TestMain IF NOT EXIST "$(TargetDir)IceBox" ( XCOPY /E /I /Y "$(SolutionDir)Externals\IceBox" "$(TargetDir)IceBox" ) IF NOT EXIST "$(TargetDir)bzip2.dll" ( COPY "$(SolutionDir)Externals\IceBox\bzip2.dll" "$(TargetDir)" ) XCOPY /E /I /Y "$(SolutionDir)Externals\Infragistics" "$(TargetDir)" 但是这个命令只在我创建调试或发布时使用。 当我发布我的项目时,这个命令会被忽略。 是否可以在我发布项目时使用此命令? 谢谢你的帮助。 回答1 我最近遇到了类似的问题。 我想“仅”在发布应用程序时运行命令,而不是在每次构建时运行。 我添加了一个发布发布任务。 由于我不直接使用 MSBuild,因此我修改了我的解决方案 csproj 文件。 例子: 解决方案名称: MyKillerApp 项目文件名: MyKillerApp.csproj 使用 Notepad++

2021-11-26 08:21:40    分类:技术分享    visual-studio-2010   publish   post-build-event

构建前和构建后事件参数(Pre and Post Build event parameters)

问题 在 Visual Studio 中,有人能给我指出可用的构建前和构建后事件参数的列表吗? 例如。 $(TargetDir)等 回答1 此链接提供完整和更新的列表。 但是,如果它中断,则此答案将丢失。 目前,对于 VS 2015,我们有: $(配置名称) 当前项目配置的名称,例如“Debug|Any CPU”。 $(外向) 输出文件目录的路径,相对于项目目录。 这将解析为输出目录属性的值。 它包括尾部反斜杠“\”。 $(DevEnvDir) Visual Studio 2005的安装目录(用驱动器和路径定义); 包括尾部反斜杠“\”。 $(平台名称) 当前目标平台的名称。 例如,“AnyCPU”。 $(项目目录) 项目的目录(用驱动器和路径定义); 包括尾部反斜杠“\”。 $(项目路径) 项目的绝对路径名(使用驱动器、路径、基本名称和文件扩展名定义)。 $(项目名称) 项目的基本名称。 $(项目文件名) 项目的文件名(使用基本名称和文件扩展名定义)。 $(ProjectExt) 项目的文件扩展名。 它包括“。” 在文件扩展名之前。 $(解决方案目录) 解决方案的目录(用驱动器和路径定义); 包括尾部反斜杠“\”。 $(解决方案路径) 解决方案的绝对路径名(使用驱动器、路径、基本名称和文件扩展名定义)。 $(解决方案名称) 解决方案的基本名称。 $(解决方案文件名)

2021-11-24 21:08:22    分类:技术分享    c#   visual-studio   build   post-build-event   pre-build-event

如何在构建事件中检索主要/次要/构建/修订号(How can I retrieve major/minor/build/revision number on build events)

问题 嗨! 我正在使用这段代码,在后期构建事件中复制一些文件: <PropertyGroup> <DemoPath1>..\demoPath1</DemoPath1> </PropertyGroup> <Target Name="AfterBuild"> <Exec Command="robocopy $(ProjectDir)$(DemoPath1) $(ProjectDir)demoPath2/$(Revision) * /XD .svn _svn /XF *.cs /S" IgnoreExitCode="true" /> </Target> 如您所见,我想使用$(Revision) - 显然,这行不通...... 有人可以帮我吗? @mods:我不知道到底要使用哪个标签……一方面是 msbuild,另一方面是 Visual Studio ……? 随意编辑! 回答1 最简单的方法是: <GetAssemblyIdentity AssemblyFiles="$(TargetPath)"> <Output TaskParameter="Assemblies" ItemName="AssemblyVersion" /> </GetAssemblyIdentity> 我是这样使用它的: <Exec Command="robocopy $(ProjectDir)$

2021-11-24 14:34:07    分类:技术分享    visual-studio   msbuild   csproj   post-build-event   post-build

Post-build event command for publish (Visual Studio 2010)

I have a project in visual studio 2010. This project has the following post-build event command lines: SET TARGET_PROJECT=TestMain IF NOT EXIST "$(TargetDir)IceBox" ( XCOPY /E /I /Y "$(SolutionDir)Externals\IceBox" "$(TargetDir)IceBox" ) IF NOT EXIST "$(TargetDir)bzip2.dll" ( COPY "$(SolutionDir)Externals\IceBox\bzip2.dll" "$(TargetDir)" ) XCOPY /E /I /Y "$(SolutionDir)Externals\Infragistics" "$(TargetDir)" But this commands are just used when I create a debug or a release. When I publish my project will this commands ignored. Gives it a possibility to use this commands when I publish the

2021-11-22 06:51:39    分类:问答    visual-studio-2010   publish   post-build-event

How can I remove tralling backslash from $(ProjectDir)?

I have a command line like this in my post-build event: aspnet_regiis -pef connectionStrings "$(ProjectDir)" -prov "DataProtectionConfigurationProvider" But aspnet_regiis is returning a failure because the tralling \ in the directory. Pass full name, path + web.config doesn't work either. How can I solve this?

2021-11-20 15:52:09    分类:问答    .net   windows   visual-studio-2013   post-build-event