msbuild

How can I get MSBuild to copy all files marked as Content to a folder, preserving folder structure?

我怕爱的太早我们不能终老 提交于 2019-12-18 04:12:14
问题 As part of my solution build, I want to copy all "Content" files (asp?x etc) to another folder. Since these are so clearly tagged in the project, I thought there must be an easy way to copy these instead of writing my own post-build step with xcopy. Unfortunately I haven't been able to figure this out - this msbuild thing is incompatible with my brain. I just want a step like but can't figure out the syntax to use. Bat file syntax suggestions would not be an answer to this question - only

New .csproj format - How to specify entire directory as “linked file” to a subdirectory?

早过忘川 提交于 2019-12-18 04:01:53
问题 With the new .csproj format (as well as the old), it is possible to add files as linked outside of the project folder: <EmbeddedResource Include="..\..\..\Demo\Sample.cs" Link="Resources\Sample.cs" /> It is also possible to use a glob pattern to include multiple files: <EmbeddedResource Include="..\..\..\Demo\*.cs" /> But how do you combine the two? What I Tried <EmbeddedResource Include="..\..\..\Demo\*.cs" Link="Resources\*.cs" /> <EmbeddedResource Include="..\..\..\Demo\*.cs" Link=

Configure MSBuild output path

蹲街弑〆低调 提交于 2019-12-18 03:54:47
问题 There is a Windows Forms (NET 3.5) project, foo.csproj, with localized resources files. I use MSBuild to build the project and create a deployment structure: <MSBuild Projects="foo.csproj" Properties="Configuration=Release;OutputPath=..\deploy\foo" Targets="Build" /> It copies foo.exe and all localized DLL files to the deploy\foo folder, but I need localized DLL files to be copied into a separate folder. It should be: deploy\foo\foo.exe deploy\locales\ru-RU\foo.resources.dll deploy\locales\pt

Can I set the platform toolset from the command line when building with VS2010's msbuild?

二次信任 提交于 2019-12-18 03:37:12
问题 When I'm building a VS2010 with msbuild from the command line, can I change the platform toolset to v90 (i.e. Visual Studio 2008 toolchain) from the command line, without editing the vcxproj file? I'm using the following command line in my build script currently: mysystemf("msbuild %s.vcxproj /t:rebuild /p:configuration=release,platform=%s", prjname, platform); 回答1: Yes you can set PlatformToolset without change the vcxproj file. If you open a vcxproj file, you'll see that there is a

MsBuild copy file after build

丶灬走出姿态 提交于 2019-12-18 03:05:13
问题 I want to copy an xml file from the main directory to bin\Debug after building the project, but my solution doesn't work. I edited .csproj file and added: <Target Name="AfterBuild"> <Copy SourceFiles="Controllers.xml" DestinationFolder="\bin\Debug" ContinueOnError="true" /> </Target> What am I doing wrong? The build is successful. 回答1: Your destination folder is (most likely) wrong. If you specify it with a leading backslash, it is actually just a shortform for <current-drive-letter>\bin

Signing assemblies with PFX files in MSBuild, Team Build, and TFS

家住魔仙堡 提交于 2019-12-18 03:04:36
问题 I get this error when trying to build a project using Team Build (MSBuild) on TFS 2010: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (1970): Cannot import the following key file: CCC.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_C00C673BBB353901 C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common

How to detect the status of msbuild from command line or C# Application

我与影子孤独终老i 提交于 2019-12-18 03:04:10
问题 I am writing up a checkout, build and deployment application in C#, and need to know the best way to detect whether my call to msbuild.exe has succeeded or not. I have tried to use the error code from the process, but I am not sure whether this is always accurate. Is there a way (through the code below) that I can tell whether msbuild.exe completed successfully? try { Process msbProcess = new Process(); msbProcess.StartInfo.FileName = this.MSBuildPath; msbProcess.StartInfo.Arguments =

How to detect the status of msbuild from command line or C# Application

冷暖自知 提交于 2019-12-18 03:04:08
问题 I am writing up a checkout, build and deployment application in C#, and need to know the best way to detect whether my call to msbuild.exe has succeeded or not. I have tried to use the error code from the process, but I am not sure whether this is always accurate. Is there a way (through the code below) that I can tell whether msbuild.exe completed successfully? try { Process msbProcess = new Process(); msbProcess.StartInfo.FileName = this.MSBuildPath; msbProcess.StartInfo.Arguments =

Creating a list of Folders in an ItemGroup using MSBuild

北战南征 提交于 2019-12-17 22:56:57
问题 I'm trying to build an ItemGroup in an MSBuild script which contains a list of folders directly below a given 'Root' folder. So - in this example... + Root folder ---- Sub Folder 1 -------- Sub-Sub Folder 1 -------- Sub-Sub Folder 2 ---- Sub Folder 2 ---- Sub Folder 3 ... I would want my ItemGroup to contain "Sub Folder 1", "Sub Folder 2" and "Sub Folder 3". There may be a number of files at any point in the hierarchy, but I'm only interested in the folders. Can anyone help!? 回答1:

How do I target a specific .NET project within a Solution using MSBuild from VS2010?

China☆狼群 提交于 2019-12-17 22:48:38
问题 I have an MSBuild command line that can build an entire solution. It looks something like this: msbuild SomeSolution.sln /p:Configuration:CustomDebug;Platform=OurPlatform /nodeReuse:false /maxcpucount:4 /t:Build I know that for C++ Solutions, specific projects can be targeted using the following syntax: msbuild SomeSolution.sln /p:Configuration:CustomDebug;Platform=OurPlatform /nodeReuse:false /maxcpucount:4 /t:Folder\SomeCppProject;Build I'm trying to achieve the same thing for .NET projects