Hi Guys, My project is developped by vs2015. Unfortunately I have to support winXp, so my target framework version is 4.0 in vs. This is my setting in teamcity MSBuild version: Microsoft build too. The location of the MSBuild.exe executable. String: No: MSBuild with.NET Framework, xbuild on Unix with Mono. 1.0: logger: The full path to the assembly containing the custom logger to use. Contrary to the usual MSBuild command line, arguments MUST NOT be passed to the logger by appending them after the logger name separated by a semicolon. The Visual Basic and C# compilers are also included in this download. (In earlier versions, these tools were included in the stand-alone.NET Framework.) System Requirements Supported Operating System Windows 7 Service Pack 1, Windows 8, Windows 8.1, Windows Server 2008 R2 SP1, Windows Server 2012, Windows Server 2012 R2. Download Visual Studio Community, Professional, and Enterprise. Try Visual Studio IDE, Code or Mac for free today. Manual Download Copy and Paste the following command to install this package using PowerShellGet More Info Install-Module -Name Invoke-MsBuild -RequiredVersion 2.4.0. For example, the MSBuild 4.0 Toolset defines SDK40ToolsPath to point to the 7.0A SDK, but the MSBuild 4.011.0 Toolset defines the same property to point to the 8.0A SDK. If VisualStudioVersion is unset, SDK40ToolsPath would point to 7.0A, but if VisualStudioVersion is set to 11.0.
It is designed for MSBuild 16.0, 15.0, 14.0, 12.0, 4.0, 3.5, 2.0.
For MSBuild 15+ the command uses the module VSSetup, see PSGallery.
If VSSetup is not installed then the default locations are used.
VSSetup is required for not default installations.
MSBuild 15+ resolution: the latest major vers
It is designed for MSBuild 16.0, 15.0, 14.0, 12.0, 4.0, 3.5, 2.0.
For MSBuild 15+ the command uses the module VSSetup, see PSGallery.
If VSSetup is not installed then the default locations are used.
VSSetup is required for not default installations.
MSBuild 15+ resolution: the latest major version (or absolute if -Latest),
then Enterprise, Professional, Community, BuildTools, other products.
For MSBuild 2.0-14.0 the information is taken from the registry.
Download Msbuild 2010
Installation Options
Copy and Paste the following command to install this package using PowerShellGet More Info
You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More
Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More
Author(s)
Roman Kuzmin
Copyright
(c) Roman Kuzmin
Package Details
Owners
Tags
Functions
Dependencies
This script has no dependencies.
FileList
- Resolve-MSBuild.nuspec
Version History
Version | Downloads | Last updated |
---|---|---|
1.5.0 | 216 | 10/16/2019 |
1.4.1 | 53 | 4/9/2019 |
1.4.0 (current version) | 11 | 4/3/2019 |
1.3.0 | 109 | 3/17/2018 |
1.2.1 | 47 | 12/6/2017 |
1.2.0 | 98 | 7/28/2017 |
1.1.2 | 7 | 7/26/2017 |
1.1.1 | 28 | 6/29/2017 |
1.1.0 | 47 | 4/4/2017 |
1.0.1 | 17 | 3/20/2017 |
1.0.0 | 9 | 3/18/2017 |
Install Msbuild
I need to package results of the build to the ZIP file. Options:
- Zip task from MSBuild Community Tasks Project
- 7z.exe or something else in source control
- Custom task
- Code task
And considerations:
The MSBuild Community Tasks Zip task requires tasks lib to be included before build. This actually means that you cannot download it from build script. They have Nuget Package, but if you use package restore you are out of lack.
Second option is to use one of the zip compression tools. Main problem that you need this exe. So if you do not want it in your source control, you need to download it. You can try chocolatey, but I decided that this is too complicated for me.
Custom task. I think this is joke.
Code task. With UsingTask element you can just code your task with C# directly in MsBuild file. In most case this sounds like an overkill, but anyway I will go with this option.
Download Msbuild 4.0 Free
Zip Task Implementation
Msbuild 2.0
You need something to make a zip. You can actually use any library , but I will use one that is shipped with .NET 4.5.
Important, you should have .NET 4.5 installed to make this work.
Msbuild Extension Pack 4.0 Download
The following gist is actual implementation.
Download Msbuild 2015
<Projectxmlns='http://schemas.microsoft.com/developer/msbuild/2003' |
ToolsVersion='4.0'DefaultTargets='Sample' > |
<ImportProject='Zip.targets' /> |
<TargetName='Sample' > |
<ZipSourceFolder='C:UsersAdministrator.WIN-BOAS4C4GH8KProjectsTemp'OutputFileName='package.zip' /> |
</Target> |
</Project> |
<Projectxmlns='http://schemas.microsoft.com/developer/msbuild/2003'> |
<!-- Simple ZIP task that utilize .NET 4.5 Zip Compression --> |
<!-- |
Example |
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003" |
ToolsVersion='4.0' DefaultTargets='Sample' > |
<Import Project='Zip.targets' /> |
<Target Name='Sample' > |
<Zip SourceFolder='C:SomeFolder' OutputFileName='output.zip' /> |
</Target> |
</Project> |
you can run this project with msbuild |
--> |
<UsingTaskTaskName='Zip'TaskFactory='CodeTaskFactory'AssemblyFile='$(MSBuildToolsPath)Microsoft.Build.Tasks.v4.0.dll'> |
<ParameterGroup> |
<SourceFolderParameterType='System.String'Required='true'/> |
<OutputFileNameParameterType='System.String'Required='true' /> |
<NoBackupParameterType='System.Boolean'Required='false' /> |
</ParameterGroup> |
<Task> |
<ReferenceInclude='System.Core' /> |
<ReferenceInclude='Microsoft.CSharp' /> |
<ReferenceInclude='System.IO.Compression' /> |
<ReferenceInclude='System.IO.Compression.FileSystem' /> |
<UsingNamespace='System' /> |
<UsingNamespace='System.IO' /> |
<UsingNamespace='System.Net' /> |
<UsingNamespace='System.Linq' /> |
<UsingNamespace='System.Reflection' /> |
<UsingNamespace='Microsoft.Build.Framework' /> |
<UsingNamespace='Microsoft.Build.Utilities' /> |
<UsingNamespace='System.IO.Compression' /> |
<CodeType='Fragment'Language='cs'> |
<![CDATA[ |
try { |
SourceFolder = Path.GetFullPath(SourceFolder); |
OutputFileName = Path.GetFullPath(OutputFileName); |
Log.LogMessage('Package zip... (' + OutputFileName + ' )'); |
// Prepare output temp file |
var tmpFile = Path.ChangeExtension(OutputFileName, '.zip.tmp'); |
File.Delete(tmpFile); |
// Zip folder |
ZipFile.CreateFromDirectory(SourceFolder, tmpFile); |
// Replace output file |
File.Delete(OutputFileName); |
File.Move(tmpFile, OutputFileName); |
return true; |
} |
catch (Exception ex) { |
Log.LogErrorFromException(ex); |
return false; |
} |
]]> |
</Code> |
</Task> |
</UsingTask> |
</Project> |
And it works . Mission complete.