msbuild

Modify MSBuild ItemGroup Metadata

一个人想着一个人 提交于 2019-12-17 18:34:32
问题 Is it possible to modify a ItemGroup's metadata after it is declared. For Example: <ItemGroup> <SolutionToBuild Include="$(BuildProjectFolderPath)\MySolution.sln"> <Targets></Targets> <Properties></Properties> </SolutionToBuild> </ItemGroup> <Target Name="BuildNumberOverrideTarget"> <!--Code to get the version number from a file (removed)--> <!--Begin Pseudo Code--> <CodeToChangeItemGroupMetaData ItemToChange="%(SolutionToBuild.Properties)" Condition ="'%(SolutionToBuild.Identity)' == '$

Using Microsoft.Build.Evaluation to publish a database project (.sqlproj)

末鹿安然 提交于 2019-12-17 18:28:46
问题 I need to be able to publish an SSDT project programmatically. I am looking at using Microsoft.Build to do so but can not find any documentation. It seems pretty simple to create the .dacpac, but how would I either publish to an existing database or at the very least to a .sql file. The idea is to have it do what it does when I right click on the project and select publish. It should compare with a selected database and generate an upgrade script. This is what I have so far to create the

Installing a windows service on remote machine using given username

好久不见. 提交于 2019-12-17 17:48:31
问题 What is the best way to install a windows service written in C# (in the standard way) on a remote machine, where I need to provide the username and password it should run as? I am going to run it from MSBuild as part of integration tests. EDIT: I don't have an msi and I don't want to create one. 回答1: You can use the SC command. sc.exe \\remotecomputer create newservice binpath= C:\Windows\System32\Newserv.exe start= auto obj= DOMAIN\username password= pwd (Note the spaces after the equals

web.config file transform from command line

会有一股神秘感。 提交于 2019-12-17 17:39:28
问题 I have two build environments to target; Release and Staging. The Web.config looks like this: <system.web> <authentication mode="Windows"> </authentication> <authorization> <deny users="?" /> </authorization> </system.web> I want to transform it by building to staging config: Web.Staging.config <system.web> <authentication mode="Windows"> </authentication> <authorization xdt:Transform="Replace"> <deny users="?" /> <allow roles="StagingRoles" /> <deny users="*" /> </authorization> </system.web

How to build MSI package on a linux server?

限于喜欢 提交于 2019-12-17 17:28:08
问题 I have a windows desktop application which is currently available on a Linux server for download on user's machine. I want to automate the process of MSI packaging on the same Linux server using any EXE/DLL . I have an App.exe and App.txt file. Some information should be read from text file and injected into exe before creating an MSI package. This entire process has to happen dynamically in the Linux server only after the user clicks on download. Can anybody point me in the right direction

The builds tools for v120 (Platform Toolset = 'v120') cannot be found

怎甘沉沦 提交于 2019-12-17 17:26:27
问题 Using visual studio 2012 on windows 8 x64 aparantly this is caused by msbuild being moved into .net but I havn't seen how to fix it yet. 4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for v120 (Platform Toolset = 'v120') cannot be found. To build using the v120 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install v120 to build using the v120

Team Foundation Server 2018 Build agent Capabilities VS 2019

那年仲夏 提交于 2019-12-17 16:54:08
问题 We use Team Foundation Server 2018. Since our upgrade to Visual studio 2019 I have been trying to add this capability to TFS 2018, without any success. TFS version: 2018 (16.122.27102.1) I have already tried to reconfigure the Agent, or even add a new one. Visual studio 2019 is installed on the TFS server + has the same checks as the 2017. Deleting VS 2017 on the server doesn't help either, no capabilities found then. Are there any tips/tricks that I need to perform to get TFS working with

How to find Windows SDK's SetEnv.cmd / SetEnv.cmd Does not work correctly

走远了吗. 提交于 2019-12-17 16:47:11
问题 We have a Team City Build Server running and want to compile a Visual C++ project. So far this would be easy, since I've setup our Windows Build Agent with the Windows SDK, but we don't have a solution / project file. The project files are instead created with CMake. CMake seems to be a little bit dumb (can't generate Solution when Visual Studio is not installed), but with some tricks, I could get it to do it. The solution can then be built with MSBuild. And here comes the problem. For this

Treat all warnings as errors

折月煮酒 提交于 2019-12-17 16:24:34
问题 This should be obvious to do, but I just couldn't make it work... What I'm trying to do is simple: I would like my compilation to fail with an error if there is a warning . Yes, the famous TreatWarningsAsErrors ... I configured it in my C# project properties This results in the expected TreatWarningsAsErrors section in my csproj: <TreatWarningsAsErrors>true</TreatWarningsAsErrors> So far so good, if I add an useless private variable in my code, it results in a compilation error: private int

Is there any MSbuild task to check if a string contains another string (similar to string.contains)

拈花ヽ惹草 提交于 2019-12-17 16:24:34
问题 I have this Msbuild code: <Import Project="A.proj" Condition="$(BuildDefinition) =='Dist Staging to Dev' Or $(BuildDefinition) =='Dist Staging to Dev(Services Only)'"/> But I was wondering if is there anything similar to check if an string contains some text to get something similar to: <Import Project="A.proj" Condition="$(BuildDefinition) CONTAINS 'Dist Staging to Dev'"/> 回答1: If you use MSBuild 4, you could use Property function <Import Project="A.proj" Condition="$(BuildDefinition