msbuild

Force a tool version with MSBuild from inside the file?

戏子无情 提交于 2019-12-23 10:19:33
问题 I've moved my project over to .NET 4.0 recently, and am having some trouble running the ASP.NET compiler inside of my build. This doesn't work because MSBuild by default uses an old tools version when running the ASP.NET Compiler. I've been able to address it my specifying the tools version explicitly (yes, I'm running MSBuild 4.0) like so: msbuild /t:MyTarget /tv:4.0 mybuildfile.msbuild Is there any directive I can use from within the build file itself which will allow me to call msbuild in

MissingMethodException when referencing Microsoft.Build and System.IO.Compression

半腔热情 提交于 2019-12-23 09:59:06
问题 I have a "Classic Desktop" .NET project which references Microsoft.Build 15.1 from NuGet and System.IO.Compression / System.IO.Compression.FileSystem from the .NET SDK / GAC. I'm trying to upgrade this to Microsoft.Build 15.3. Microsoft.Build 15.3 introduces a dependency on System.IO.Compression 4.1.2.0. The version of System.IO.Compression in the .NET Framework is 4.0.0.0. If I compile like this, I get a warning about being unable to resolve assembly conflicts, but my code works: warning

How do I access current Project context within a custom Task?

大城市里の小女人 提交于 2019-12-23 09:58:27
问题 How do I access current Project context within a custom Task in MSBuild? At first it appeared as though the GlobalProjectCollection reference on ProjectCollection would allow access, but this appears to be empty, at least when running MSBuild from the commandline. I can currently get new Project instance based off of the current project file in the following manner: List projectAssemblies = new List(); using (XmlReader projectFileReader = XmlReader.Create(this.BuildEngine

Hudson : warning MSB3245: Could not locate the assembly “nunit.framework”

…衆ロ難τιáo~ 提交于 2019-12-23 09:30:53
问题 I'm working in a Virtual Machine as a Hudson Slave. In the virtual machine, I add the path to the MSBuild I want to use : %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\; I added also the path to NUnit : C:\Program Files\NUnit 2.5.7\bin\net-2.0; And so, I can run the NUnit and MSBuild command lines in my VM. But I get this error when my Hudson Job build my solution : C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning MSB3245: Could not resolve this reference. Could

MSBuild TargetOutputs doesn't include Foo.exe.config file?

你。 提交于 2019-12-23 09:27:39
问题 I'm using the MSBuild task as follows: <MSBuild Projects="Foo.csproj"> <Output TaskParameter="TargetOutputs" ItemName="FilesToDeploy" /> </MSBuild> However, the FilesToDeploy item group only includes the .EXE files built by the project file; it doesn't include the Foo.exe.config file. Another question: Who copies App.config to App.exe.config? explains how exactly MSBuild finds/copies the config file, but I can't figure out how to actually get the name. I found a similar question elsewhere,

stop solution build on first compilation\link error - msbuild

独自空忆成欢 提交于 2019-12-23 09:26:47
问题 I'm compiling a solution with many projects inside using VS2013's MSBuild. I want the build to stop if one of the projects fails to compile and that the error code of msbuild will be non-zero to indicate something has failed. Can it be done? I am running this command to start compiling: %MS_BUILD_PATH% "%workarea%\WindowsSolution.sln" /p:Configuration=Release /p:ContinueOnError=false /p:StopOnFirstFailure=true but it doesn't work as I want it. Any suggestions? 回答1: If anyone is still looking

NuGet restoring PostSharp package before the build begins

此生再无相见时 提交于 2019-12-23 09:21:03
问题 I am using PostSharp and I have the following target description in my project file: <Target Name="EnsurePostSharpImported" BeforeTargets="BeforeBuild" Condition="'$(PostSharp30Imported)' == ''"> <Error Condition="!Exists('..\..\packages\PostSharp.3.1.33\tools\PostSharp.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://www.postsharp.net/links/nuget-restore." /> <Error

Injecting assembly version numbers at build time

那年仲夏 提交于 2019-12-23 09:19:59
问题 I want to change the assembly version number of a C# project at build time by passing it as a property on the MSBuild command line. AssemblyInfo Task will modify the assembly version inside a AssemblyInfo.cs before compiling. This is nearly what I want. The problem is I don't want AssemblyInfo.cs to be changed because of source control issues. I don't want all these AssemplyInfo.cs files to show as being modified and needing to be checked in every time we do a build. What I would like is a

Accessing the build revision number in Powershell script during TFS build

不打扰是莪最后的温柔 提交于 2019-12-23 09:17:38
问题 I can get the build number from IBuildDetail.BuildNumber but this is taken from the build definition and there fore might not include the revision number $(Rev:.r) or it might not be at the end. So I would like to get this number without having to parse it from the build number. Is this property available any where during the build? 回答1: Use the build variables. From PowerShell use $Env:BUILD_BUILDNUMBER if you’re using TFS 2015. See MSDN: Use a PowerShell script to customize your build

MSBuild Using Incorrect Version of sgen.exe to Generate XmlSerializer dlls?

烈酒焚心 提交于 2019-12-23 09:13:48
问题 I am using TeamCity to run an MSBuild script that cleans and rebuilds one of our solutions. When I deploy the dlls that are built by this process, the web server returns an error about [MyType].XmlSerializer.dll that "This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded." Here are my notes so far: The solution is a Visual Studio 2010 solution that is targeting the .Net Framework 3.5. TeamCity is set to mimic this. It is set up with MSBuild version -