专家,我正在使用msbuild构建一长串Visual Studio项目.在隐藏msbuild输出时,在msbuild完成其工作时会显示基于某些字符的状态和动画.这里我的脚本使用msbuild构建并显示等待动画(你肯定会喜欢这个......):
$anim=@("|","/","-","\","|") # Animation sequence characters
$ReturnCode = @{}
$BuildStatus="Building $(ProjectName)"
$CursorTop=[Console]::CursorTop #// Cursor position on Y axis
$CursorLeft=$BuildStatus.Length #// Cursor position on X axis
Write-Host $BuildStatus -ForegroundColor Cyan
#// starting the MsBuild job in background.
$MsbJob = [PowerShell]::Create().AddScript(
{
param($MsbArgs, $Result)
& msbuild $MsbArgs | Out-Null
$Result.Value = $LASTEXITCODE
}
).AddArgument($MsbArgs).AddArgument($ReturnCode)
$async = $MsbJob.BeginInvoke() #// start executing the job.
#// While above script block is doing its job in background, display status and animation in console window.
while …Run Code Online (Sandbox Code Playgroud) 在Visual Studio 2012中,我运行了以下Post-Build任务来编译和组合我的LESS文件:
$(MSBuildBinPath)\msbuild.exe "$(ProjectDir)MSBuildSettingsLess.xml"
Run Code Online (Sandbox Code Playgroud)
我的MSBuildSettingsLess.xml看起来像:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003">
<Target Name="CompileDotlessCss">
<ItemGroup>
<Binaries Include="*.dll;*.exe"/>
</ItemGroup>
<!-- Compile dotLess CSS into minified full CSS -->
<Exec Command="$(SolutionDir)..\Tools\dotless.compiler.exe $(ProjectDir)..\GMHC\Content\less\responsive.less $(ProjectDir)..\GMHC\Content\bootstrap-responsive.less.css"/>
<Exec Command="$(SolutionDir)..\Tools\dotless.compiler.exe $(ProjectDir)..\GMHC\Content\less\bootstrap.less $(ProjectDir)..\GMHC\Content\bootstrap.less.css"/>
</Target>
</Project>
Run Code Online (Sandbox Code Playgroud)
在Visual Studio 2013中,失败并出现以下错误:
命令"C:\ Program Files(x86)\ MSBuild\12.0\bin\msbuild.exe"C:\ Users\Administrator\Documents\Projects\MedicalMissions\GMHC\MSBuildSettingsLess.xml退出,代码为9009.
输出窗口显示以下内容:
1>'C:\ Program'不被识别为内部或外部命令,
1>可操作程序或批处理文件.
1> C:\ Program Files(x86)\ MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(4429,5):错误MSB3073:命令"C:\ Program Files(x86)\ MSBuild\12.0\bin\msbuild.exe"C:\ Users\Administrator\Documents\Projects\MedicalMissions\GMHC\MSBuildSettingsLess.xml"
知道为什么失败或者如何走到最底层?
假设我在一个属性中得到了这个AB_1.2.3.112211
我想要的是交换第一个"." 到一个"_"
因此它变为AB_1_2.3.112211两个第一个字符可能更长fx ABCD_1.2.3.112211但它仍然应该是输出ABCD_1_2.3.112211
有没有办法在msbuild任务中执行此操作?
我的主要目标是缩小的JS脚本添加到我的ASP.NET Web应用程序的部署包使用cmd.
此外,我的问题似乎与这个主题重复,甚至这个和这个,情况并非如此.我的问题是我试过挂钩CopyAllFilesToSingleFolderForPackageDependsOn,CopyAllFilesToSingleFolderForMsdeployDependsOn甚至PipelineCollectFilesPhaseDependsOn没有运气.我<Message Text="Inside of CustomCollectFiles" Importance="high"/>在我的习惯Target中使用了Sayed Ibrahim Hashimi 在他的回答中提出并/v:diag转换msbuild.exe来验证这个事实.我不知道如何修复它:尝试将上述问题中不同修改的相应XML片段.csproj直接放入文件中,并将其放入.wpp.targets用于自定义打包的单独文件中.
我的开发环境包括VS2010和VS2013,我通过Web PI,Web部署工具,Windows Azure SDK安装了Web部署3.5.我的系统PATH环境var包括c:\Windows\Microsoft.NET\Framework64\v4.0.30319\;c:\Program Files\IIS\Microsoft Web Deploy V3能够运行MSBuild和MSDeploy从cmd.当我查看MSBuild日志时,我看到:
CopyAllFilesToSingleFolderForMsdeployDependsOn =
;
;
CopyAllFilesToSingleFolderForPackageDependsOn =
;
;
;
Run Code Online (Sandbox Code Playgroud)
有些东西在这里
PipelineDeployPhaseDependsOn =
;
Package;
Run Code Online (Sandbox Code Playgroud)
所以我的问题是在哪里找到我的错误包装管道的来源?我错过了哪种额外的诊断?
asp.net msbuild visual-studio-2010 microsoft-web-deploy visual-studio-2013
如何确定是否在MSBuild .targets文件中以调试(或发布)模式构建项目,并将此信息用作另一个属性的条件?
就像是:
<OutDir Condition="IsDebug">bin\Debug\$(SomeOtherProperty)\</OutDir>
<OutDir Condition="!IsDebug">bin\Release\$(SomeOtherProperty)\</OutDir>
Run Code Online (Sandbox Code Playgroud)
是否有诸如“调试/发布”模式之类的东西,或者它们仅仅是不同配置属性值集的常规名称?
我正在使用以下powershell脚本来构建Web项目:
$tools = @()
$tools += "C:\Windows\System32" #xcopy
$tools += "C:\Windows\Microsoft.NET\Framework\v4.0.30319" #msbuild
$env:Path = [string]::join('; ', $tools)
msbuild ROS.EDI.Web/ROS.EDI.Web.csproj `
/p:DeployOnBuild=true `
/p:PublishProfile=$config `
/p:Configuration=$config `
/p:Platform=AnyCPU `
/p:DefineConstants=$constants `
/property:ApplicationVersion=$env:BUILD_NUMBER `
/property:ApplicationRevision=$env:BUILD_VCS_NUMBER
Run Code Online (Sandbox Code Playgroud)
脚本完成,msbuild在我的开发机器和构建服务器上运行时没有错误.但是,将Web项目发布到本地文件系统的步骤不会在构建服务器上运行.
这是我的开发机器上msbuild的相关输出
PipelinePreDeployCopyAllFilesToOneFolder:
Publish Pipeline Deploy phase Stage ...
WebFileSystemPublish:
...
Run Code Online (Sandbox Code Playgroud)
并在构建服务器上
PipelinePreDeployCopyAllFilesToOneFolder:
Publish Pipeline Deploy phase Stage ...
Package:
Invoking Web Deploy to generate the package with ...
Run Code Online (Sandbox Code Playgroud)
我试图弄清楚为什么"包"步骤在构建服务器上而不是"WebFileSystemPublish"上运行.是什么导致相同版本的msbuild在两台不同的机器上表现不同?
在您将此标记为重复之前,我已阅读以下内容并尝试使用其解决方案无效:
此WiX安装项目在Visual Studio中编译没有问题.
但是,使用msbuild任务在NAnt中运行它会显示以下错误.
热预建事件:
"$(SolutionDir)\App_Tools\WiX Toolset v3.8\bin\heat.exe" dir "$(SolutionDir)\App_Shell \bin\$(ConfigurationName)" -dr "AppDirectory" -cg "AppComponentGroup" -t "$(ProjectDir)Filter.xslt" -gg -g1 -sf -srd -sreg -var "var.AppAppPath" -out "$(ProjectDir)\App_HarvestedHeatFile.wxs"
Run Code Online (Sandbox Code Playgroud)
msbuild任务:
<msbuild project="App_Installers\App.Setup\App.Setup.wixproj">
<property name="Configuration" value="Release"/>
<property name="target" value="Rebuild"/>
<property name="verbosity" value="Normal"/>
</msbuild>
Run Code Online (Sandbox Code Playgroud)
错误信息Prebuild:
[msbuild] Build started 03.02.2014 15:38:35.
[msbuild] Project "E:\Projects\Company\App\Development\trunk\src\App_Inst
allers\App.Setup\App.Setup.wixproj" on node 1 (default targets).
[msbuild] AssignCultures:
[msbuild] Culture: en-US
[msbuild] Culture: de-DE
[msbuild] PreBuildEvent:
[msbuild] "*Undefined if not building a solution or within Visual Studio*\App_Tools\WiX Toolset v3.8\bin\heat.exe" dir "*Undefined if not …Run Code Online (Sandbox Code Playgroud) 我们有我们AssemblyVersion和AssemblyFileVersion在一个单独的属性文件属性.这是因为它们在所有项目之间"链接",并由构建服务器更新.我们不希望在每次构建或发布后手动更新版本.
AssemblyInfo.cs:
[assembly: AssemblyTitle("MyProductTitle")]
[assembly: AssemblyCulture("")]
[assembly: Guid("579eb194-08f1-44fc-9422-21aaf6cb2963")]
Run Code Online (Sandbox Code Playgroud)
AssemblyVersionInfo.cs:
[assembly: AssemblyFileVersion("0.0.14056.19")]
[assembly: AssemblyVersion("0.0.0.0")]
Run Code Online (Sandbox Code Playgroud)
问题是我们的构建服务器抱怨每个项目的以下警告:
CA1016 : Microsoft.Design : Add an AssemblyVersion attribute to 'MyProduct.dll'.
Run Code Online (Sandbox Code Playgroud)
在本地构建项目时,bin中的实际DLL文件应用了所有版本号(文件属性对话框):

在Visual Studio中查看项目属性时,在程序集信息中未检测到版本信息:

我的猜测是,这是由于AssemblyVersion而AssemblyFileVersion不是居住在AssemblyInfo.cs.
有没有办法"包含"自定义AssemblyVersionInfo.cs文件?
我正在尝试以编程方式编译Silverlight项目.最初我只是包装了MsBuild.exe,但是有一个错误说:
C:\ Program Files(x86)\ MSBuild\Microsoft\Silverlight\v5.0\Microsoft.Silverlight.Common.targets(104,9):未安装Silverlight 4 SDK.
我正在使用SilverLight 5并安装了Silverlight 4和Silverlight 5的SDK.该解决方案在Visual Studio中编译良好.我按照这个问题的建议:
MSBuild命令行错误 - 未安装Silverlight 4 SDK
我从跑步开始:
C:\ WINDOWS\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe
至:
C:\ WINDOWS\Microsoft.NET \框架\ v4.0.30319\msbuild.exe
这解决了这个问题,但是由于需求的变化,我现在需要使用Microsoft.Build而不包装MsBuild exe.我有以下代码:
var globalProperty = new Dictionary<string, string> { { "Configuration", "Debug"}, { "Platform", "Any CPU" } };
var buildParameters = new BuildParameters(new ProjectCollection()) { Loggers = new List<ILogger> { this.logger } };
var buildRequest = new BuildRequestData(@"C:\example\solution.sln", globalProperty, "4.0", new[] {"Build" }, null);
BuildResult buildResult = BuildManager.DefaultBuildManager.Build(buildParameters, buildRequest);
Run Code Online (Sandbox Code Playgroud)
但是,我现在再次看到:
ValidateSilverlightFrameworkPaths:ERROR C:\ Program Files(x86)\ MSBuild\Microsoft\Silverlight\v5.0\Microsoft.Silverlight.Common.targets(104,9):未安装Silverlight …
我有一个正在进行部署的python脚本.我想从msbuild运行该脚本并获取输出,以防它通过或失败.那么,如何与msbuild进行状态通信和错误文本?我想在构建服务器上显示结果.我必须使用python 2.7,并且不能使用3.x.
msbuild ×10
.net ×3
msbuild-task ×3
c# ×2
powershell ×2
.net-4.0 ×1
animation ×1
asp.net ×1
assemblyinfo ×1
console ×1
deployment ×1
less ×1
msbuild-4.0 ×1
nant ×1
nantcontrib ×1
python-2.7 ×1
silverlight ×1
targets ×1
tfs ×1
wix ×1