msbuild-task

MSBuild AfterPublish Target

天大地大妈咪最大 提交于 2019-12-11 04:49:33
问题 I want a particular file copied in with the published output of my web project. I tried changing the Build Action to Content and changing the Copy to Output Directory to Copy always . This works fine except that it buries it down in a sub folder the same way it is in the project. I do not want it buried down in a sub folder. I want it sitting right next to the rest of of the published output. I thought I might instead handle this problem using the AfterPublish Target. Can someone show how I

MSBuild BeforeBuild Step

北战南征 提交于 2019-12-10 22:06:23
问题 I asked yesterday about getting AfterBuild working and was able to get that working by placing it at the very bottom of the Project section: MSBuild AfterBuild Step I have tried the exact same thing with a different project. This is my BeforeBuild code: <Target Name="BeforeBuild"> <Message Text="###HI###" Importance="High" /> </Target> I don't have another before Target Name="BeforeBuild" in the project and I have this placed at the very bottom of the Project section. The .vcxproj is parsing

The AssemblyTitle never changes once set, I want it to be changed per configuration

元气小坏坏 提交于 2019-12-10 17:45:25
问题 I would like to change the text shown in the screenshot below based on the Product name. I know, the text is taken from Assembly.Title property which is a read only property and so can not be changed at runtime. So how do I change it at compile time? We sell the application to multiple customers and the name of the application should change per customer. We have a configurations for each customer. So at build time, Assembly title should be selected as per the configuration. Any suggestion how

Encrypting password in a MSBuild file

≡放荡痞女 提交于 2019-12-10 17:38:55
问题 I want to encrypt the password I am supplying in the following code: <Target Name="Default"> <!-- Install a service on a Remote Machine --> <MSBuild.ExtensionPack.Computer.WindowsService TaskAction="Install" ServiceName="__TestService1" User="$(User)" Password="$(password)" ServicePath="c:\WINDOWS\system32\taskmgr.exe" RemoteUser="$(RemoteUser)" RemoteUserPassword="$(RemoteUserPassword)" MachineName="$(RemoteMachine)" /> </Target> I dont want to hardcode the password. How can I encrypt it?

Is there an MSBuild task that will write lines to the *start* of a file?

馋奶兔 提交于 2019-12-10 15:47:09
问题 I'm using a WriteLinesToFile to update a change log file (txt). It appends the text to the end of the file. Ideally, I'd like to be able to write the changes to the start of this file. Is there a simple task (e.g. in the Community or Extension packs) that does this? 回答1: I haven't seen something like that in the custom task pack. You could cheat by using ReadLinesFromFile and WriteLinesToFile : <PropertyGroup> <LogFile>log.txt</LogFile> </PropertyGroup> <ItemGroup> <Log Include="Line1"/> <Log

Use MSBuild to build Entity Framework Model without using the Project File?

元气小坏坏 提交于 2019-12-10 14:59:52
问题 I am in the process of build a script for a fairly big project. One of the projects require an Entity Framework Model to be compiled into a library. Due to the way the build server works, all builds are hand crafted to manage the various deployment scenarios without affecting the developers and the project files. Is there anyway to generate the EF Model using an MSBuild task without using the project file generated by Visual Studio? Currently the actual assembly compiles using a CSC task,

MSbuild, How to access project property value in Inline Task code?

笑着哭i 提交于 2019-12-10 14:58:13
问题 I have inline Task code written in csharp I wonder if there is anyway to access propect property in inline Task code For ex. I am trying to replace string match with project property value. is it possible? <![CDATA[ MatchCollection matches = Regex.Matches(SourceStr, Pattern); for (int i = 0; i < matches.Count; i++) // replace the match value with project property... possible? ]]> 回答1: Pass it as a parameter, like you would with a compiled task? <ParameterGroup> <Foo ParameterType="System.Bar"

Exec Task in MSBuild for execution of command on remote machine

青春壹個敷衍的年華 提交于 2019-12-10 12:19:43
问题 I am using following command to install a service via MSBuild file. This works great <Exec Command= 'c:\test\myService.Appservices.exe install' ContinueOnError='false' /> But the above command install the service on local machine. I want to install the service on a remote machine. How can I specify the machine name using this command? 回答1: As per Mike Vine's comment, MSBuild doesn't include tools for remote execution. You could however use something like psexec. e.g. <Exec Command='psexec

How do you recursively call tasks in MSBuild?

不羁岁月 提交于 2019-12-10 09:46:57
问题 E.g. I want to call these scripts passing diff params each time: <ItemGroup> <SqlFiles Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\Tables\*.sql" /> <SqlFiles Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\Functions\*.sql" /> <SqlFiles Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\Views\*.sql" /> <SqlFiles Include="$(SourceServicesDbSqlRootDir)CreateScripts\$(SourceServiceName)\ForeignKeys\*.sql" /> <SqlFiles

Visual Studio 2017 MSBuild Task Development

≯℡__Kan透↙ 提交于 2019-12-10 09:46:39
问题 With developing an custom MSBuild Task with Visual Studio 2017 RC, I have the following problem: As soon as I add other dependencies than just Microsoft.Build.Utilities.Core (using v15.1.0-preview-000458-02 for .NET Core Support), I cannot load the task into another .csproj MSBuild project as the dependencies are not found. Is there a way to automatically copy all dependencies to the Debug folder? Or do I have to publish it every time I want to test it? Update1: The problem with publish was