I have a "Unable to copy file X.DLL" in a MSBuild task on my CruiseControl.Net project.
My CCNet project is like this :
<project name="Trunk" queue="Back" queuePriority="1">
<tasks>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
<workingDirectory>D:\wwwroot\CruiseControl\Working\trunk</workingDirectory>
<projectFile>kop.sln</projectFile>
<buildArgs>/noconsolelogger /v:quiet /p:Configuration=Debug</buildArgs>
<targets>ReBuild</targets>
<timeout>600</timeout>
</msbuild>
</tasks>
</project>
The build report is as follows :
<msbuild startTime="09/21/2011 15:56:11" elapsedTime="00:00:32" elapsedSeconds="32" success="false">
<warning line="0" column="0" timeStamp="09/21/2011 15:56:12"><![CDATA[MSB3021 : Impossible de copier le fichier "D:\wwwroot\CruiseControl\Working\trunk\Reporting\bin\Release\Reporting.dll" vers "back\\Bin\Reporting.dll". Impossible de trouver une partie du chemin d'accès 'D:\wwwroot\CruiseControl\Working\trunk\Reporting\bin\Release\Reporting.dll'.]]></warning>
<warning line="0" column="0" timeStamp="09/21/2011 15:56:12"><![CDATA[MSB3021 : Impossible de copier le fichier "D:\wwwroot\CruiseControl\Working\trunk\KoamaOP\bin\Release\KoamaOP.dll" vers "back\\Bin\KoamaOP.dll". Impossible de trouver une partie du chemin d'accès 'D:\wwwroot\CruiseControl\Working\trunk\KoamaOP\bin\Release\KoamaOP.dll'.]]></warning>
It works perfectly fine when I launch it from a console on my own computer.
The file it tries to copy (\bin\ Release\KoamaOP.dll) does not exists, but \bin\ Debug\KoamaOP.dll exists. Why does it try to get the Release dll, although I specified /p:Configuration=Debug ?
What can be the root of the problem ?
Thanks
Have you verified that the file D:\wwwroot\CruiseControl\Working\trunk\Reporting\bin\Release\Reporting.dll actually exists on the build box? It may be that the path is incorrect.
The copy is trying to put the file under a "back" folder. Is this a pre-build or post-build step you added to save old versions of files? If so, you might have one of those steps misconfigured.
As to it working on your box - I suspect you already have the Release version of the dll built, so the copy step doesn't fail. If you delete all of the dlls on your box and then rebuild, I suspect you will find the same problem.
Related
Update:
I have reproduced the same Error with a new empty VS2015 WebApplication project.
Added a connectionString to a new empty SQL database
Added a sql-script file to the solution and selected publish... in the publish wizard.
Example of web Publish wizard with included Update script.
I will get the same error building a web deployment package or web deploy .
Original post:
The "SqlScriptPreprocessSqlVariables" task failed unexpectedly. This happens when I use publishing wizard or MSBuild with a profile where the Update Database is selected. On a newly installed machine with only VS2015 Update1 and also on our build server with Team Fondation Server 2015 Build Agent. The same publish profile works in our VS2013 environment.
System.TypeLoadException: Signature of the body and declaration in a method implementation do not match.
Type: 'Microsoft.Web.Publishing.Tasks.SqlScriptPreprocessor.SqlCommandExecuter'.
Assembly: 'Microsoft.Web.Publishing.Tasks, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
at Microsoft.Web.Publishing.Tasks.SqlScriptPreprocessor.SqlScriptPreprocessSqlVariables.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask>d__26.MoveNext()
Here is the same error but from the Build Agent in the new build system. I got the same error runnig XAML build on the new Agent.
##[error]C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Deploy\Microsoft.Web.Publishing.MSDeploy.Common.targets(119,5): Error MSB4018: The "SqlScriptPreprocessSqlVariables" task failed unexpectedly.
##[error]System.TypeLoadException: Signature of the body and declaration in a method implementation do not match. Type: 'Microsoft.Web.Publishing.Tasks.SqlScriptPreprocessor.SqlCommandExecuter'. Assembly: 'Microsoft.Web.Publishing.Tasks, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
##[error] at Microsoft.Web.Publishing.Tasks.SqlScriptPreprocessor.SqlScriptPreprocessSqlVariables.Execute()
##[error] at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
##[error] at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
This is how I fixed the webdeploy packaging problem. This is not a solution I recommend but it works on my machine and on the build server.
Locate the file Microsoft.Web.Publishing.MsDeploy.Common.targets
This is the location on my machine:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Deploy\ Microsoft.Web.Publishing.MsDeploy.Common.targets
On row 117 and forward I commented out the following section.
<!--<SqlScriptPreprocessSqlVariables
UnsupportedKeywords="$(MsdeploySqlUnsupportedCommand)" CheckForUnsupportCommands="$(CheckSqlScriptForUnsupportedCommands)"
TreadSqlScriptUnsupportedCommandsAsWarning="$(TreadSqlScriptUnsupportedCommandsAsWarning)"
SqlScriptFile="%(_DatabasesToPackageForSQL.SourcePath)"
DestinationGroup="%(_DatabasesToPackageForSQL.DestinationGroup)"
ResolveIncludes="$(SqlScriptPreProcessResolveIncludes)"
BatchDelimiter="$(SqlScriptPreProcessBatchDelimiter)"
Condition="$(EnableSqlScriptVariableParameterize) And '%_DatabasesToPackageForSQL.SourcePath)' != '' And Exists('%(_DatabasesToPackageForSQL.SourcePath)') ">
<Output TaskParameter="List" ItemName="_DatabasesToPackage_SqlVariables" />
</SqlScriptPreprocessSqlVariables>-->
I recently faced the same issue and I solved it installing the latest version of "SQL Server Data Tools" and restarting the machine. As #JimAho mentioned, the problem is related to SQL Server Data Tools version installed.
Here you could download it
Don't forget to restart the machine.
Still not quite satisfied with these solutions, I did some research and the least invasive approach I can see is simply registering the assembly in the GAC.
Run VS Command Prompt as Administrator
Hit Windows Start
type "Developer"
Right Click "Developer Command Prompt for VS 2017"
Select Run as Administrator
Run the following command (Replace Enterpise with your installation, e.g. Professional, BuildTools, Community):
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLCommon\130\Microsoft.SqlServer.BatchParser.dll"
I need to run a kettle(ktr) file from the orbeon or more specifically from the xpl file. I was thinking of running a batch file but i cant find any step to do it. How can i run the batch/ktr file from within the xpl file?
To run external commands from XPL you van use the undocumented oxf:execute-processor, for instance (borrowed to XForms Unit):
<p:processor name="oxf:execute-processor">
<p:input name="config" href="#control" transform="oxf:xslt">
<exec executable="/home/vdv/projects/xformsunit/resources/apps/xformsunit/browser-run.sh"
xsl:version="2.0">
<arg
line=" http://localhost:8080/orbeon/xformsunit/suite/{/*/name}/results?implementation=xsltforms&uid={/*/uid}"
/>
</exec>
</p:input>
<p:output name="stdout" id="stdout" debug="stdout"/>
<p:output name="stderr" id="stderr" debug="stderr"/>
<p:output name="result" id="result" debug="result"/>
</p:processor>
AFAIK this processor hasn't been documented but you should be able to find more examples on the mailing list.
Setting LaunchTarget e.g. to "cmd.exe" works fine, after the installation of the burn package, the desired command line window pops up. However, setting LaunchTarget to for example "[InstallFolder]\Path\To\Postinstallexecutable.exe" yields an error:
Error 0x80070002: Failed to launch target: C:\Program Files (x86)\Path\To\Postinstallexecutable.exe
The path is correct, executing "C:\Program Files (x86)\Path\To\Postinstallexecutable.exe" at the command line works fine. Is this a bug or am I missing something? WiX toolset version is 3.8.309.0.
Update: After a little more testing, the problem seems to occur only when you try to pass a parameter to the command in LaunchTarget. So for example using
<Variable Name="LaunchTarget" Value="[InstallFolder]\Basiskomponenten\Allgemein\test.cmd" />
works, while
<Variable Name="LaunchTarget" Value="[InstallFolder]\Basiskomponenten\Allgemein\test.cmd Test123" />
results in an 0x80070002 error.
The LaunchTarget variable points only to the executable that should be launched, it cannot be provided the command-line arguments. It wasn't until a very recent build of WiX v3.8 that you could set a second variable called LaunchArguments that provides the arguments. So, try upgrading to yesterday's WiX v3.8 build (or newer) and do:
<Variable Name="LaunchTarget" Value="[InstallFolder]\Basiskomponenten\Allgemein\test.cmd" />
<Variable Name="LaunchArguments" Value="Test123" />
I have inherited a system that requires a dbschema to be deployed to multiple databases (one per client) and set up a nightly build to deploy changes to my dev tier (sample below). About 50% of the time it works great, but the other 50% I get an error somewhere in the middle of the build:
"d:\builds{Project}\Dev Nightly Database Update\BuildType\TFSBuild.proj" (EndToEndIteration target) (1) ->
"d:\builds{Project}\Dev Nightly Database Update\Sources\Database\Database.dbproj" (Rebuild;Deploy target) (3:18) ->
(DspDeploy target) ->
C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.TSqlTasks.targets(120,5): error MSB4018: The "SqlDeployTask" task failed unexpectedly. [d:\builds{Project}\Dev Nightly Database Update\Sources\Database\Database.dbproj]
C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.TSqlTasks.targets(120,5): error MSB4018: There is a file locking violation. Close any external application that uses the database file. [d:\builds{Project}\Dev Nightly Database Update\Sources\Database\Database.dbproj]
I have looked around but not found any real solutions. I assume that I am getting the error because msbuild is still using the dbproj file when the next iteration starts up. I tried putting a Sleep task in as a last ditch effort but that hasn't helped at all.
Any other suggestions?
<Target Name="Client DB Deploy" Outputs="%(Database.Name)">
<MSBuild Projects="$(SolutionRoot)\Database\Database.dbproj"
Properties="Configuration=Default; OutDir=$(BinariesRoot)\$(Configuration)\;
DeployToDatabase=True;TargetDatabase=%(Database.Name);
TargetConnectionString=Data Source=$(DatabaseServer)%3BIntegrated Security=True;
AlwaysCreateNewDatabase=False;BlockIncrementalDeploymentIfDataLoss=False"
Targets="Rebuild;Deploy" />
<Copy SourceFiles="$(OutDir)..\Database.sql" DestinationFolder="$(OutDir)_SetupPackages\_Database\%(Database.Name)" />
<SleepTask Timeout="10000" /> <!--sleep the build to try and avoid file locks we get in the loop-->
Try to add MSBuild task parameters RunEachTargetSeparately="True" or UnloadProjectsOnCompletion="True". See http://msdn.microsoft.com/en-us/library/z7f65y0d.aspx
I have this trouble:
I am using VS 2008 Team Suite, and I have WinForms csproj. I want Publish it using ClickOnce.
In Publish Properties of csproj, I have these values:
Publishing Folder Location (web site,
ftp server, or file path):
C:\ClickOnce\Frk.Security.CarWin.WebInstall\Publicacion\
Installation Folder URL (if different
than above):
http://CHANGETHESERVER/carwinclickonce/Publicacion/
Publish Version: 1.0.0.0
Prerrequisites: Windows Installer 3.1,
.NET 35. sp1
Now, I publish and all is OK. I need deploy my app to several machines (Development, Preproduction, production environments...), and I use Msbuild...
<Microsoft.Sdc.Tasks.Folder.CopyFolder
Source="Publicacion"
Destination="$(Directorio_Destination)\Publicacion" />
I copy C:\ClickOnce\Frk.Security.CarWin.WebInstall\Publicacion\ to another machine, in folder (this folder is root of a Web Site)
\\desiis\c$\Webs\carwinclickonce\Publicacion\
(http://desiis/carwinclickonce/Publicacion/)
I use MSBUILD and Mage like this; variable $(ProviderUrl) = http://desiis/carwinclickonce/Publicacion/
<Target Name="PublishClickOnce">
<Exec Command="$(Mage) -u $(PublishDir)\Frk.Security.CarWin.application -pu $(ProviderUrl)" />
<Exec Command="$(Mage) -u $(PublishDir)\Frk.Security.CarWin.application -cf $(CertDir)\Frk.Security.CarWin_TemporaryKey.pfx" />
</Target>
Now, I have my publish.htm in http://desiis/carwinclickonce/Publicacion/publish.htm.
There are two links to install application:
1. ) http://desiis/Carwinclickonce/Publicacion/Frk.Security.CarWin.application
Everything is OK for this option.
) http://desiis/Carwinclickonce/Publicacion/Setup.exe
This option gets errors!
The errors are the following:
Error al intentar descargar
'http://CHANGETHESERVER/carwinclickonce/Publicacion/Frk.Security.CarWin.application'.
(FAILS when try download
'http....Frk.Security.CarWin.application')
Vea el archivo de registro de la
instalación que se encuentra en
'C:\DOCUME~1\xxxxxx\CONFIG~1\Temp\VSD5B7.tmp\install.log'
para obtener más información.
install.log contents:
The following properties have been
set: Property: [AdminUser] = true
{boolean} Property:
[ProcessorArchitecture] = Intel
{string} Property: [VersionNT] = 5.1.3
{version} Running checks for package
'Windows Installer 3.1', phase
BuildList The following properties
have been set for package 'Windows
Installer 3.1': Running checks for
command
'WindowsInstaller3_1\WindowsInstaller-KB893803-v2-x86.exe'
Result of running operator
'VersionGreaterThanOrEqualTo' on
property 'VersionMsi' and value '3.1':
true Result of checks for command
'WindowsInstaller3_1\WindowsInstaller-KB893803-v2-x86.exe'
is 'Bypass' 'Windows Installer 3.1'
RunCheck result: No Install Needed
Launching Application.
URLDownloadToCacheFile failed with
HRESULT '-2146697211' Error: Error al
intentar descargar
'http://CHANGETHESERVER/carwinclickonce/Publicacion/Frk.Security.CarWin.application'.
(FAILS when try download
'http....Frk.Security.CarWin.application')
Any ideas? Can I use Mage.exe commands? How can I modify setup.exe?
Update:
use msbuild for using setup -url=http://desiis/....
<Exec Command="$(PublishDir)\setup -url=$(ProviderUrl)" />
Another problem is that after using the /url switch to change out the URL, a message box appears for manually confirming that the signature will be invalided for the assembly.
How can use setup -url=http://.... in silent mode?
How can I sign the setup.exe again?
My msbuild
<Target Name="PublishClickOnce">
<Exec Command="$(PublishDir)\setup -url=$(ProviderUrl)" />
<Exec Command="$(Mage) -u $(PublishDir)\Frk.Security.CarWin.application -pu $(ProviderUrl)" />
<Exec Command="$(Mage) -u $(PublishDir)\Frk.Security.CarWin.application -cf $(CertDir)\Frk.Security.CarWin_TemporaryKey.pfx" />
</Target>
To clarify, ClickOnce works. Your problem is with the setup.exe bootstrapper file that Visual Studio generates to install prerequisites. You use a bogus server name (CHANGETHESERVER) and change it later depending on what server you deploy to. The server name can easily be changed for the .application file but you're unsure how to fix the setup.exe file since it tries to launch http://CHANGETHESERVER/... after installs the prereqs. Is all this correct?
I'm not sure how to update your setup.exe file to point to the proper url. However, I wouldn't worry about updating it. I would go to Visual Studio, change "CHANGETHESERVER" to an actual server (like your Development server), and publish. The setup.exe that's generated will be good for the server you used. Keep a copy of that .exe and do the process again for your other servers (QA, Production, etc.). Deploy the server specific files to each server and you're done.
The setup.exe files aren't going to change unless you're adding/removing prerequisites. There's no need to generate and deploy a new one every time you deploy.
update:
Now, Publish and All is OK done. I need deploy my Publish in several machines (Development, Preproduction, production environments...), and I use Msbuild.
Then, using MSBUILD
<Microsoft.Sdc.Tasks.Folder.CopyFolder Source="Publicacion" Destination="$(Directorio_Destination)\Publicacion" />
I copy C:\ClickOnce\Frk.Security.CarWin.WebInstall\Publicacion\ to another machine, in folder (this folder is root of a Web Site)
\desiis\c$\Webs\carwinclickonce\Publicacion\
(http://desiis/carwinclickonce/Publicacion/)
I use MSBUILD and Mage like this; variable $(ProviderUrl) = http://desiis/carwinclickonce/Publicacion/
<Target Name="PublishClickOnce">
<Exec Command="$(Mage) -u $(PublishDir)\Frk.Security.CarWin.application -pu $(ProviderUrl)" />
<Exec Command="$(Mage) -u $(PublishDir)\Frk.Security.CarWin.application -cf $(CertDir)\Frk.Security.CarWin_TemporaryKey.pfx" />
</Target>