Visual Studio 2015 exception SqlScriptPreprocessSqlVariables when running web publish wizard with update database - msbuild

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"

Related

Unified primary reference

I am facing issue getting my project to build on server. The same project build fine locally on my machine (VS 2017 15.8). Teamcity sever also has the same msbuild tool version installed. It doesn't have VS 2017.
Project build on server results in following error:
"error CS0433: The type 'OracleCommand' exists in both
'Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral,
PublicKeyToken=89b483f429c47342' and 'Oracle.ManagedDataAccess,
Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342'
So far I have been able to pin point the cause of the error to due to autounify not triggering/working at resolving package reference (I am using package reference for nuget packages) for project build.
I also confirmed that teamcity server doesn't contain Microsoft.NET.Build.Extensions.
Any idea on how shall I proceed towards resolving this issue. I know installing VS 2017 on TC server will likely resolve this, but that's not an option now. Any ideas people?
Here's how I solved the problem on team-city server:
- Copied Microsoft.NET.Build.Extensions folder from my local machine to MSBuild/Microsoft older
- Copied Microsoft.NET.Build.Extensions.targets file to MSBuild\15.0\Microsoft.Common.Targets\ImportAfter folder
Above steps resolved the build issue on TC server.

trouble publishing website TFS 2013

I have a TFS 2013 build that I'm trying to get to publish to a folder on the build server. I've installed WebDeploy, but I always get the error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets (4274): Web deployment task failed. (Could not connect to the remote computer ("localhost"). On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Management Service") is started. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE.)
I've set up a website on the build server and that's where I'm trying to publish the website. Actually I don't even care about publishing it per se - I just need my build output to go to a folder locally automatically. Right now we have to manually open the solution and choose Publish... to get the output that subsequent InstallShield builds need for input. Here are my MSBuild arguments. Does anyone have any idea what could be missing?
/p:SrcDir=C:\Builds\TFS\WebApps\Src
/p:RevKeyname=WebAppsRevNr
/p:DeployOnBuild=true
/p:DeployTarget=MsDeployPublish
/p:MSDeployServiceURL=https://127.0.0.1:8172/msdeploy.axd
/p:CreatePackageOnPublish=True
/p:DeployIisAppPath="WebApp"
/p:MsDeployPublishMethod=WMSVC
/p:AllowUntrustedCertificate=True
/p:AutoParameterizationWebConfigConnectionStrings=False
/p:Authtype=NTLM /p:username=""
I've checked both net start wmsvc and net start msdepsvc and both are running. Any ideas?
Thanks!
UPDATE
I've tried everything that Andy suggested and now when I run this from the command line I get this bizarre error message:
"C:\Workspace\VS2013\WebApps\Main\Src\webapps.sln" (default target) (1) ->
"C:\Workspace\VS2013\WebApps\Main\Src\CoreWebApps\CoreWebApps.csproj"
(default
target) (7) ->
(AutoParameterizationWebConfigConnectionStringsCore target) ->
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web
.Publishing.targets(2295,5): error : Could not open Source file: Could not
find
a part of the path
'C:\Workspace\VS2013\WebApps\Main\Src\CoreWebApps\Areas\Adm
in\Views\Web.config;Areas\Admin\Views\Web.config'.
[C:\Workspace\VS2013\WebApps
\Main\Src\CoreWebApps\CoreWebApps.csproj]
Any idea why it's looking for Web.config;Areas\Admin\Views\Web.config'.? That makes no sense.
Please try below items to narrow down the issue:
Try to use IP or Machine Name instead of "localhost"
Logon your build agent machine, then manually execute the same
MSBuild command within the same arguments(which you provided in build
definition) to build and deploy your solution, then check result. You
need to ensure you can manually run the same MSBuild command within
deploy argument to build and deploy your solution successfully from
build agent machine. Then use the same deploy arguments in TFS Build
definition.
Double check Web Deploy settings to make sure that the name of the
website is exactly that of what's in IIS.
Install Web Management Tools before Web
Deploy : Install the Web Management Services (Roles -> Web Server >
Management Tools > Management Services). Then uninstall Web Deploy, and then install Web Deploy again.
You can also reference this thread for your troubleshooting.
Update:
For the issue "Could not open Source file: Could not find a part of the path" you can reference below similar articles for the troubleshooting.
https://social.msdn.microsoft.com/Forums/en-US/8f959964-c951-4f9a-8486-8283a925c9f6/build-error-could-not-open-source-file-though-i-know-it-exists?forum=windowsazurewebsitespreview
https://our.umbraco.org/forum/getting-started/installing-umbraco/60222-Umbraco-721-Build-fails-after-deploy-to-Azure-WebSite (See the last two answers)

Errors while installing VS2015 tools for .NET Core 1.0 development

I have difficulties updating my development machine to use the newest Visual Studio tools to support my development.
I did the following (VS2015 means Visual Studio 2015 Community Edition):
Uninstall my previous version of VS2015 Update 1. I should mention that I have installed various stuff on top of this such as AspNet5.ENU.RC1_Update1_KB3137909.exe and VWDOrVs2015AzurePack.exe (VS tools for Azure).
Restart
Install VS2015 using this file vs_community__55e913f53149d443afc7d14b09172fd9.exe. This ended with minor errors such as
[0EE0:0E48][2016-08-10T11:42:51]i301: Applying execute package: MobileServicesConnectedServices_VS, action: Install, path: C:\ProgramData\Package Cache{A4495E4F-5218-48FB-8AD2-F3076011B9E1}v14.0.23107\packages\MobileServicesConnectedServices\MobileServicesConnectedServices_VisualStudio14.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7" NOVSUI="1"' [16DC:16E0][2016-08-10T11:42:58]i000: MUX: ExecuteError: Package (MobileServicesConnectedServices_VS) failed: Error Message Id: 1722 ErrorMessage: There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor.
[0EE0:0E48][2016-08-10T11:42:58]e000: Error 0x80070643: Failed to install MSI package.
and
[0EE0:0E48][2016-08-10T11:42:45]i301: Applying execute package: AuthenticationConnectedServices_VS, action: Install, path: C:\ProgramData\Package Cache\{3FEAC561-1CF6-41D6-B0F3-BECDD9C88A1B}v14.0.23107\packages\AuthenticationConnectedServices\AuthenticationConnectedServices_VisualStudio14.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7" NOVSUI="1"' [16DC:16E0][2016-08-10T11:42:50]i000: MUX: ExecuteError: Package (AuthenticationConnectedServices_VS) failed: Error Message Id: 1722 ErrorMessage: There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor.
[0EE0:0E48][2016-08-10T11:42:51]e000: Error 0x80070643: Failed to install MSI package.
Restart
Now, if I try to install the VS2015 Tools Preview from a file called DotNetCore.1.0.0-VS2015Tools.Preview2.exe I get this error:
Setup has detected that Visual Studio 2015 Update 3 may not be completely installed. Please repair Visual Studio 2015 Update 3, then install this product again.
and when I open the log file I see this:
[1B14:1A6C][2016-08-10T12:58:43]e000: Error 0x81f40001: Bundle condition evaluated to false: WixBundleInstalled OR NOT(((VS2015CommunityUpdateVersion <> VS2015UpdateVersion) AND (VS2015CommunityExists) AND (VS2015UpdateVersionExists)) OR ((VS2015ProfessionalUpdateVersion <> VS2015UpdateVersion) AND (VS2015ProfessionalExists) AND (VS2015UpdateVersionExists)) OR ((VS2015EnterpriseUpdateVersion <> VS2015UpdateVersion) AND (VS2015EnterpriseExists) AND (VS2015UpdateVersionExists)) OR ((VS2015WebExpressUpdateVersion <> VS2015UpdateVersion) AND (VS2015WebExpressExists) AND (VS2015UpdateVersionExists))) OR (SKIP_VSU_CHECK=1) OR (WixBundleAction=2)
I am now trying to install from scratch using a fresh Windows 10 installation to avoid problems related to side-effects from earlier installations.
I'm curious though to find out, what might cause these problems, and find out if I am doing something wrong.
Edit 2016-08-10: I have now verified that the same error occurs on a freshly installed Windows 10.
I found the solution after some more digging. It turns out many people faced this problem as described here:
(Click the Reviews tab):
https://visualstudiogallery.msdn.microsoft.com/c94a02e9-f2e9-4bad-a952-a63a967e3935
After trying this from a command prompt:
DotNetCore.1.0.0-VS2015Tools.Preview2.exe SKIP_VSU_CHECK=1
the installation continues.
Above didn't work for me, nor did several other solutions I found online, but this finally worked:
Go to extensions folder, e.g. C:\Program Files (x86)\Microsoft
Visual Studio 14.0\Common7\IDE\Extensions
There will be a lot of cryptically named folders, e.g. "kehkjkd2.pme"
Open each folder to see if it is a nuget extension folder (if it contains ~40 files named nuget.*.dll)
If it is a nuget extension folder, delete it or move it to a backup folder.
Repeat - there may be multiple folders containing nuget.
After doing the above and rebooting (not sure if the reboot is necessary), the .NET Core 1.0.0 VS 2015 Tooling Preview 2 install worked.

Application crashes on startup - missing Microsoft.VisualBasic.PowerPacks

I wrote a simple VB.NET application which works fine on the development machine.
However on another machine, even though the .NET Framework is installed, it crashes on startup with System.InvalidOperationException.
There seems to be a problem with it finding the Visual Basic assemblies.
Here is one of the fails (I replaced sensitive information with three dots):
*** Assembly Binder Log Entry (16/06/2013 # 15:45:12) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Users\....
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = ...
LOG: DisplayName = Microsoft.VisualBasic.PowerPacks.Vs, Version=10.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///C:/Users/......
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MSystemAdmin.exe
Calling assembly : MSystemAdmin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.VisualBasic.PowerPacks.Vs, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/.../Desktop/Microsoft.VisualBasic.PowerPacks.Vs.DLL.
LOG: Attempting download of new URL file:///C:/.../Desktop/Microsoft.VisualBasic.PowerPacks.Vs/Microsoft.VisualBasic.PowerPacks.Vs.DLL.
LOG: Attempting download of new URL file:///C:/.../Desktop/Microsoft.VisualBasic.PowerPacks.Vs.EXE.
LOG: Attempting download of new URL file:///C:/.../Desktop/Microsoft.VisualBasic.PowerPacks.Vs/Microsoft.VisualBasic.PowerPacks.Vs.EXE.
LOG: All probing URLs attempted and failed.
It isn't that clear why PowerPacks is missing, the .NET 4 Client Profile could be an issue. There have been multiple versions of PowerPacks around and the version numbering got to be a mess. On my machine, that same version is reported as v2.0.50727, even though it is stored in the GAC as version 10.0
Best thing to do is to go back to your project. Click the "Show All Files" icon on the toolbar in the Solution Explorer window. That now shows the References node. Expand it and select the PowerPacks reference. In the Properties window, change the Copy Local property to True.
Rebuild and your build directory now will have a copy of the DLL. Copy it along with the EXE onto the target machine.
Here is the URL to download Microsoft Visual Basic Power Packs 10.0
http://go.microsoft.com/fwlink/?LinkID=145727&clcid=0x804
Apparently, it seems to be a problem with the "PowerPacks"; these are additional controls to the ones given by default in Visual Studio (in the form design part, under "Toolbox"). If you install the required package on the target computer, everything should be fine.
I had this problem in the past and my recommendation is not relying on these elements: they include nice-to-have features (in my case, it was an elliptic shape) but might be replaced with a bit of work and simpler objects. If you want to sell your program to a more or less wide audience, relying on this might become a problem: this package is not installed by default on virtually any computer and thus you would have to ask your clients to go ahead with the installation. Locating these specific controls is straightforward: on the "Toolbox" they should be listed under "PowerPacks" or similar.
After reading the Hans Passant's comment, I do recall that a .dll file has to be put in the same directory than the executable, but I am under the impression that the PowerPacks package from the provided link has to be installed anyway (at least, on computers not having Visual Studio).
I was upgrading Visual Studio from Visual Studio 2013 to Visual Studio 2015 on a new Windows 10 machine. In doing so I copied my Projects folder from a Windows 7 machine to the same path on the Windows 10 machine.
When I opened a project which used MS.VB.PowerPacks.VS I was informed the file could not be found. I downloaded the newest install for MS.VB.PowerPacks.VS Version 12.0.0.0. Visual Studio 2015 blanked out my form pages which used the PrintForm and informed me:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualBasic.PowerPacks.VS, Version 10.0.0.0.
I changed the reference to vcersion 12.0.0.0, but it was still not recognized.
My fix: I copied the the C:\Program Files(x86)\Reference Assemblies\Microsoft\VBPowerPacks\v10.0 folder from my Windows 7 machine to my Windows 10 machine, and then removed the v12.0.0.0 reference and added the v10.0.0.0 reference to the program. I then exited the project and opened it again, and all was well, the forms were displayed in their original beauty.

How can I fix these errors from Visual Studio Express 2012 for Windows Phone?

I am in Visual Studio Express 2012 for Windows Phone, and have followed the MiniBrowser Tutorial located at the following link:
http://msdn.microsoft.com/en-US/library/windowsphone/develop/ff402526(v=vs.105).aspx
After following all the instructions, once I get to "Run Your App" portion of the instructions, under step 1, Build, the following errors are generated:
Error 1 The name "LocalizedStrings" does not exist in the namespace "clr-namespace:MiniBrowser". c:\users\avery_000\documents\visual studio 2012\Projects\MiniBrowser\MiniBrowser\App.xaml 1 1 MiniBrowser
Error 2 The name "LocalizedStrings" does not exist in the namespace "clr-namespace:MiniBrowser". c:\users\avery_000\documents\visual studio 2012\Projects\MiniBrowser\MiniBrowser\App.xaml 10 9 MiniBrowser
Error 3 The build stopped unexpectedly because of an internal failure.
Microsoft.Build.Exceptions.BuildAbortedException: Build was canceled. Failed to successfully launch or connect to a child MSBuild.exe process. Verify that the MSBuild.exe "C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" launches successfully, and that it is loading the same microsoft.build.dll that the launching process loaded. If the location seems incorrect, try specifying the correct location in the BuildParameters object, or with the MSBUILD_EXE_PATH environment variable.
at Microsoft.Build.BackEnd.NodeProviderOutOfProc.CreateNode(Int32 nodeId, INodePacketFactory factory, NodeConfiguration configuration)
at Microsoft.Build.BackEnd.NodeManager.AttemptCreateNode(INodeProvider nodeProvider, NodeConfiguration nodeConfiguration)
at Microsoft.Build.BackEnd.NodeManager.CreateNode(NodeConfiguration configuration, NodeAffinity nodeAffinity)
at Microsoft.Build.Execution.BuildManager.PerformSchedulingActions(IEnumerable`1 responses)
at Microsoft.Build.Execution.BuildManager.HandleNewRequest(Int32 node, BuildRequestBlocker blocker)
at Microsoft.Build.Execution.BuildManager.IssueRequestToScheduler(BuildSubmission submission, Boolean allowMainThreadBuild, BuildRequestBlocker blocker) c:\users\avery_000\documents\visual studio 2012\Projects\MiniBrowser\MiniBrowser\MiniBrowser.csproj MiniBrowser
What do these errors mean?
Looks like when Visual Studio Express 2012 for Windows Phone installed on my computer, it put the project folder onto the same hard drive as the application. For some reason, the solution in order to get this to compile, was to recreate the project on a different hard drive, and work from there.
Thanks everyone for your assistance!