1。共享违规行为
之后 echo 'Copying Adventure Works Solution to Jenkins workspace...'
xcopy /s /E /H /Y /R "C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3" "C:\Program Files (x86)\Jenkins\jobs\testing003\workspace"
echo 'Deleting artifacts from previous builds...'
del "%WORKSPACE%\*_publish.zip" /F /Q
2.使用MS build
构建ms项目添加C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \环境变量路径后 并在Jenkins中设置构建C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ MSbuild.exe
'C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3\Database3.sqlproj' /p:Configuration=Database3 /p:Platform=AnyCPU /t:Build;Publish /p:SqlPublishProfilePath='C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3\Database3.publish.xml' /p:UpdateDatabase=False
Executing the command cmd.exe /C msbuild.exe "C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3\Database3.sqlproj" /p:Configuration=Database3 /p:Platform=AnyCPU /t:Build;Publish "/p:SqlPublishProfilePath=C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3\Database3.publish.xml" /p:UpdateDatabase=False C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSbuild.exe && exit %%ERRORLEVEL%% from C:\Program Files (x86)\Jenkins\jobs\testing003\workspace
[workspace] $ cmd.exe /C msbuild.exe "C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3\Database3.sqlproj" /p:Configuration=Database3 /p:Platform=AnyCPU /t:Build;Publish "/p:SqlPublishProfilePath=C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3\Database3.publish.xml" /p:UpdateDatabase=False C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSbuild.exe && exit %%ERRORLEVEL%%
'msbuild.exe' is not recognized as an internal or external command,
C:\Users\User2>cmd.exe /C msbuild.exe "C:\Users\LAB-User2\Documents\Visual S
tudio 2012\Projects\Database3\Database3.sqlproj" /p:Configuration=Database3 /p:P
latform=AnyCPU /t:Build;Publish "/p:SqlPublishProfilePath=C:\Users\LAB-User2\Doc
uments\Visual Studio 2012\Projects\Database3\Database3.publish.xml" /p:UpdateDat
abase=False C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSbuild.exe && exit %%
ERRORLEVEL%% from C:\Program Files (x86)\Jenkins\jobs\testing003\workspace
Microsoft (R) Build Engine version 4.0.30319.17929
[Microsoft .NET Framework, version 4.0.30319.18034]
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1008: Only one project can be specified.
Switch: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSbuild.exe
For switch syntax, type "MSBuild /help"
更新 完整的控制台输出
Started by user anonymous
Building in workspace C:\Program Files (x86)\Jenkins\jobs\testing003\workspace
[workspace] $ cmd /c call C:\Windows\TEMP\hudson1045566609826009314.bat
C:\Program Files (x86)\Jenkins\jobs\testing003\workspace>echo 'Copying Adventure Works Solution to Jenkins workspace...'
'Copying Adventure Works Solution to Jenkins workspace...'
C:\Program Files (x86)\Jenkins\jobs\testing003\workspace>xcopy /s /E /H /Y /R "C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3" "C:\Program Files (x86)\Jenkins\jobs\testing003\workspace"
C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3\Database3.sln
C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3\Database3.v11.suo
C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3\excludefiles.txt
C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3\Database3\Database3.dbmdl
Sharing violation
C:\Program Files (x86)\Jenkins\jobs\testing003\workspace>echo 'Deleting artifacts from previous builds...'
'Deleting artifacts from previous builds...'
C:\Program Files (x86)\Jenkins\jobs\testing003\workspace>del "C:\Program Files (x86)\Jenkins\jobs\testing003\workspace\*_publish.zip" /F /Q
Could Not Find C:\Program Files (x86)\Jenkins\jobs\testing003\workspace\*_publish.zip
C:\Program Files (x86)\Jenkins\jobs\testing003\workspace>exit 0
Path To MSBuild.exe: msbuild.exe
Executing the command cmd.exe /C msbuild.exe "C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3\Database3.sqlproj" /p:Configuration=Database3 /p:Platform=AnyCPU /t:Build;Publish "/p:SqlPublishProfilePath=C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3\Database3.publish.xml" /p:UpdateDatabase=False C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe && exit %%ERRORLEVEL%% from C:\Program Files (x86)\Jenkins\jobs\testing003\workspace
[workspace] $ cmd.exe /C msbuild.exe "C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3\Database3.sqlproj" /p:Configuration=Database3 /p:Platform=AnyCPU /t:Build;Publish "/p:SqlPublishProfilePath=C:\Users\LAB-User2\Documents\Visual Studio 2012\Projects\Database3\Database3.publish.xml" /p:UpdateDatabase=False C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe && exit %%ERRORLEVEL%%
'msbuild.exe' is not recognized as an internal or external command,
operable program or batch file.
Build step 'Build a Visual Studio project or solution using MSBuild' marked build as failure
Finished: FAILURE
答案 0 :(得分:42)
如果要使用Jenkins构建.NET项目,请执行以下步骤:
转到Jenkins -> Manage Jenkins -> Configure System
(在较新版本上:Jenkins -> Manage Jenkins -> Global Tool Configuration -> MSBuild
)
在MSBuild部分中,点击 AddMsBuild 按钮并指定详细信息:
C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe
保存并应用更改。
选择你的工作。
选择添加构建步骤。
选择MsBuild版本。
指定项目文件的路径(.csproj或.sln)
答案 1 :(得分:7)
对于较新版本的Jenkins,此选项可在此部分下找到..
Manage Jenkins -> Global Tool Configuration -> MSBuild
答案 2 :(得分:1)
对于最新版本的jenkins(3.0),您必须在Tools>Manage Jenkins
菜单中配置MSBuild。在这里命名一份工作,例如:msbuild
。
完成后,继续工作。在MSBuild模块下选择构建(在本例中为msbuild
),然后启动作业。你应该好好去。
答案 3 :(得分:0)
在作业配置中选择MSBuild版本,并在您的jenkins'中配置MSBuild版本。配置系统。
答案 4 :(得分:0)