我试图将以下命令作为MSBuild脚本的一部分运行:
for /R . %f in (*.targets) do copy /Y "%f" "C:\Program Files (x86)\MSBuild\Microso
ft\VisualStudio\TeamBuild"
Run Code Online (Sandbox Code Playgroud)
这些命令在exec中以下列方式实现:
<Exec WorkingDirectory="$(SolutionRoot)" Command="for /R . %f in (*.targets) do copy /Y "%f" "$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TeamBuild"" />
Run Code Online (Sandbox Code Playgroud)
该命令可以从控制台正常工作,但是当尝试从MSBuild运行它时,我收到错误:
Task "Exec"
Command:
for /R . %f in (*.targets) do copy /Y "%f" "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild"
f" "C:\Program was unexpected at this time.
C:\Users\rd-build\AppData\Local\Temp\OH Test2\Continuous.BuildTargets\BuildType\TFSBuild.proj(98,5): error MSB3073: The command "for /R . %f in (*.targets) do copy /Y "%f" "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild"" exited with code 255.
Done executing task …Run Code Online (Sandbox Code Playgroud) 我有两个问题:visual studio 2008和post-build events.
1)如何动态列出msbuild.exe完整路径,由后期构建事件调用?目前,我有以下(工作得很漂亮,顺便说一句): -
C:\Windows\Microsoft.NET\Framework64\v3.5\msbuild.exe
"$(ProjectDir)MSBuild\MSBuildSettings.xml"
Run Code Online (Sandbox Code Playgroud)
..但只有你有x64位环境才能工作.有没有办法使用一些内置的魔术设置?例如.$(MsBuildPath)msbuild.exe "blah....xml"??
2)我的msbuild任务执行一些操作,然后生成一个txt文件作为输出.我在msbuild xml文件中定义输出路径.
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003">
<UsingTask TaskName="CustomTask" AssemblyFile="MyAssembly.dll"/>
<Target>
<CustomTask
...
OutputFile="Foo.txt"
/>
<Target>
</Project>
Run Code Online (Sandbox Code Playgroud)
如何将实际输出文件夹传递给msbuild文件?我试过了...
OutputFile="$(OutDir)Foo.txt"
Run Code Online (Sandbox Code Playgroud)
但那失败了:(
干杯!
我已经找到了回答第二个问题的方法 - 不确定它是否是最好的...所以我对其他想法持开放态度:)
XML文件更改::添加一个设置内部变量名称的属性组,如果没有外部参数传递给msbuild.exe可执行文件.
<PropertyGroup>
<OutputFile Condition=" '$(OutputFile)'=='' ">
..\SomeFolder\Foo.txt</OutputFile>
</PropertyGroup>
<Target>
<CustomTask
...
OutputFile="$(OutputFile)"
/>
<Target>
</Project>
Run Code Online (Sandbox Code Playgroud)
现在,调用msbuild可执行文件,如...
msbuild.exe "C:\Temp Foo\Blah\MsbuildSettings" /p:OutputFile="C:\Folder 1\Folder 2\blah\"
Run Code Online (Sandbox Code Playgroud)
那工作:)
我是CruiseControl.net的新手,我正在尝试为我正在进行的项目设置它.该项目保持颠覆,但整个项目由核心项目和几个组件组成,每个组件都有一个单独的subversion项目,每个组件都有一个主干,可能的分支和标签.我需要设置cruisecontrol.net,以便主核心项目subversion文件夹以及任何包含的组件的更改触发构建.显然,如果提交包含提交给多个组件的文件,我仍然只需要一个构建.可能吗?
我刚刚加入了一个团队,无论出于什么原因,他们都不会将.sln文件签入源控件(VSS).他们创建本地解决方案文件,并从源代码管理中将Web应用程序项目添加到其中.
我试图向他们展示CruiseControl.Net的美丽但是在ccnet.config文件中,我习惯将构建工具(DEVENV)指向.sln文件.
有没有人知道我在CruiseControl中解决这个问题的最佳方法?
PS.不要滥用使用VSS,我们很快就会转移到SVN.
- 李
看起来应该可以配置Visual Studio来打印编译所需的时间.
也许在.sln文件中的某个地方.如果使用msbuild从命令行编译sln,则会打印时间.
Azure Pipeline 项目有两个构建代理
构建成功,资产、chunk.js 文件和bundle.js 文件作为工件发布
我从以前的构建代理下载工件并将它们提取到$(build.stagingDirectory)/Scripts/dist目录中,因为它们将被 ASP.net 项目使用。
我的提取文件任务 ymal 是
steps:
- task: ExtractFiles@1
displayName: 'Extract files bundle.zip'
inputs:
archiveFilePatterns: '$(Pipeline.Workspace)/dist/$(Build.BuildId)_bundle.zip'
destinationFolder: '$(build.sourcesDirectory)/Scripts/dist'
Run Code Online (Sandbox Code Playgroud)
当MSBuild构建 ASP.net 项目时,它无法找到##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets(182,5): Error MSB3030: Could not copy the file "Scripts\dist\main.bundle.js" because it was not found.
MS Build yaml 是:
steps:
- task: MSBuild@1
displayName: 'Build solution NMG.Portal.MVCForAngular'
inputs:
solution: NMG.WebApp.MVCForAngular/NMG.WebApp.MVCForAngular.csproj
msbuildArguments: '/p:ProjectFile=$(build.sourcesDirectory)\NMG.WebApp.MVCForAngular\NMG.WebApp.MVCForAngular.csproj /p:DeployOnBuild=true /p:SkipInvalidConfigurations=true /p:OutDir="$(build.stagingDirectory)\\"'
clean: false
logProjectEvents: …Run Code Online (Sandbox Code Playgroud) msbuild asp.net-mvc msbuild-task angular-cli azure-pipelines
我想自定义 OpenApiReference 元素目标。具体来说,我想在 OpenApiReference 元素定义的目标之前运行自定义目标。我怎样才能做到这一点?
假设以下配置:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<OpenApiReference Include="openapi.json" CodeGenerator="NSwagCSharp" Namespace="IntegrationService">
<Options>/GenerateDtoTypes:false /GenerateClientInterfaces:true</Options>
<ClassName>IntegrationServiceClient</ClassName>
</OpenApiReference>
</ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud) 当在 Azure Pipelines 中执行命令时,我收到错误消息:“ MSBUILD : error MSB1008: Only one project can be specified ”,dotnet publish大概是因为我的存储库名称中包含空格,但我无权更改存储库名称。
azure-pipelines.yml 的部分包含以下dotnet publish命令:
- task: DotNetCoreCLI@2
displayName: 'dotnet publish'
inputs:
command: publish
publishWebProjects: false
projects: '**/My App Backend/*.csproj'
arguments: '--configuration $(buildConfiguration) --output $(Build.
ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
displayName: 'publish artifacts'
Run Code Online (Sandbox Code Playgroud)
我尝试了以下方法来转义存储库名称中的空格,但没有成功:
还有其他方法可以逃离我所缺少的空间吗?
I emit a console app with Mono.Cecil and I want to integrate MSBuild into the build process. But then when I run dotnet build on my custom project file, MSBuild throws an error saying Expected file "obj\Debug\net5.0\refint\test.dll" does not exist. It's trying to find the generated assembly inside the refint folder. When the assembly gets generated inside obj\Debug\net5.0\test.dll as it should. Is there a way I can change the path where MSBuild looks for the output assembly? Everything on …
我正在开发一个针对 Blazor wasm 的类库,为了正常工作,客户端需要在其 Visual Studio 实例上安装 wasm-tools 工作负载。
有什么方法可以检查他们是否安装了它,如果没有安装,则生成某种错误消息?
谢谢。
msbuild ×10
c# ×4
.net-core ×1
angular-cli ×1
asp.net-mvc ×1
azure ×1
exec ×1
for-loop ×1
msbuild-task ×1
rest ×1
svn ×1