I have a SQL Server 2008 Database Project that I'm attempting to deploy using Visual Studio 2010. When I click deploy, the build works fine, but after it creates the deployment script and begins to execute it, I get the following errors:
Error 8 SQL80001: 'DatabaseName' is not a recognized option.
Error 7 SQL80001: Incorrect syntax near ':'.
Looking at the deployment script, it has the following lines:
:setvar DatabaseName "DEV_DB"
...
GO
:on error exit
So it looks like SQL Server is not running the deployment script in SQLCMD mode to understand that syntax. If I'm copying and pasting into SSMS, I can set that option, but I want to deploy straight from Visual Studio. Where is the setting to have VS run this script in SQLCMD mode OR How can I set the script to not generate using SQLCMD syntax?
Thanks.
Related
wrote a simple code by powershell
I am creating a file xml with some program settings
I want to run it before build desktop software
Get this error exited with code 1
in Visual Studio pre build event
powershell.exe $(ProjectDir)Script1.ps1
I thought it was from the wrong code. I simplified the code. However I get the same error
write-Host 'test'
exit 0
How can I solve this problem?
We have a build server with Teamcity. It should run an .exe file on a Windows Server 2012 r2 machine after building. I have wasted a day trying to make it work different ways. The last realisation is: .bat file calling an .exe with the needed parameters on a producion server and command line command in teamcity:
psexec -i \\server-ip C:/SharedFolder/RUNME.bat
This works perfectly from command line, but Teamcity shows different errors with exit codes 4, 6 or even doesn't do anything without an error.
How, HOW can I do it? Thanx.
Solved, I just had to run TeamCity services as a domain administrator.
We're using VSTS and we've started getting an error during the integration tests run during the continuous build process. We're using localdb in order to run the tests agains a predefined mdb file that is copied to the output folder of the unit test project.
We're using a powershell script to ensure that localdb is executing. IT has a single line:
SqlLocalDB.exe create "MSSQLLocalDB" -s
The connection string used for running the integration tests is built dynamically like this:
$"Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename={Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).AbsolutePath)}\\db.mdf;Integrated Security=True;MultipleActiveResultSets=True";
The only thing we've changed recently is that we've started building against .NET 4.7.1, but I think that shouldn't have any influence in these problems...
Any clues on why we've started getting these errors?
The solution to this is to ensure that the .mdf you're restoring is located in the Build agent users temp directory.
The temp directory location can be retrieved using the %TEMP% environment variable. In c#
Environment.GetEnvironmentVariable("TEMP")
You can restore using sp_attach_db
EXEC sp_attach_db #dbname = N'YourDbName', #filename1 = 'TEMPFOLDER\YourDbName.mdf'
Where TEMPFOLDER in the above line has been replace however you see fit to be the value of the TEMP environment variable.
When I create a new WebAPI project (MVC4) I get the following error.
EntityFramework.5.0.0: Failed to initialize the Powershell host. If your powershell execution policy setting is set to AllSigned, open the package manager console to initialize the host first.
jQuery.1.7.1.1: Failed to initialize the Powershell host. If your powershell execution policy setting is set to AllSigned, open the package manager console to initialize the host first.
After Googling I have found a few answers but nothing that works yet.
Error creating new MVC project - EF and JQuery
This answer seems like it should work for me as my last project was a 7z Command Line app and I might have done something daft with 7zip. But I copy pasted the 7-Zip directory from Program Files to Program Files (86) with no luck.
http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/c934fed4-e44e-4a06-9e3b-eccb9c8aa8d6
There is an answer here that might work (I haven't tried it) but even if it does work I wouldnt want to do this every time I create a new project.
Is anyone able to help me with this one?
I got around a similar error by running PowerShell as administrator with the command Set-ExecutionPolicy Unrestricted, restarting Visual Studio, and opening the Package Manager Console before what I wanted to do.
Make sure you understand the security implications of doing this first.
http://technet.microsoft.com/en-us/library/ee176961.aspx
Restricted - No scripts can be run. Windows PowerShell can be used only in interactive mode.
AllSigned - Only scripts signed by a trusted publisher can be run.
RemoteSigned - Downloaded scripts must be signed by a trusted publisher before they can be run.
Unrestricted - No restrictions; all Windows PowerShell scripts can be run.
I encountered this issue recently, after re-install VS and install the latest VS update 2, things go well. This works for me at least.
I am looking to improve my personal development process. I would like to create a batch file or similar that I can run from Windows PowerShell or the plain-old command line that does the following:
Compiles my solution (e.g. C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe /m:8 "%CD%\MySolution.sln")
If the compilation was successful, run it in debug mode, attaching the visual studio debugger, otherwise stop.
In essence, I am trying to replicate the behavior of pressing F5 in Visual Studio, but invoked from the command line. Is this possible? The reason for all this, is that I find the VS UI responsiveness degrades significantly when invoking MSBuild commands from within the IDE.
msbuild
if($?) {
# launch your process
Debug-Process -name "<Your Process Name>"
}