|
Can't work out how to do this, can anyone give some tips? I have a dataabse project in Visual Studio 2010. The project includes a CSV file. I intend to import this CSV file at deploy time in the post-deployment script via something like BULK INSERT table FROM '$(DefaultLogPath)Data.csv' but I can't find out how to copy the file to the DefaultLogPath.
(comments are locked)
|
|
Take a look at the pre and post deployment tasks. You should be able to put in a command line copy statement, or even a powershell call, from there. That's what I was thinking. But I need to reference both the source path and the destination path, which will be a UNC folder on the target SQL server. How do I reference the target SQL server name from within a post-deploy task?
Jun 24 '11 at 03:40 AM
xnl28
Hmmm... Have you tried using the server name variable? If not, then you might want to go a little more old school. Build a batch file that calls the command line for deployments, passing in your server name and then uses that same information to perform the file copy. We had to do that for a lot of our deployments.
Jun 24 '11 at 04:04 AM
Grant Fritchey ♦♦
How do I reference the server name variable from within the post-build event command line?
Jun 24 '11 at 04:14 AM
xnl28
Oooh, I knew you'd ask that. I don't have VS installed currently to look it up. Look at the properties for the project and then find the tab that has the variables on it. You'll see the exact syntax. It's something like %%server_name%%.
Jun 24 '11 at 05:05 AM
Grant Fritchey ♦♦
I don't see anything like %%server_name%% in the macros available for the post-build events in the Build Events tab. These are the macros I see there $(CatalogPropertiesFile) $(Configuration) $(DefaultLogin) $(DefaultSchema) $(DefaultUser) $(DeploymentConfigFile) $(DeployToDatabase) $(DeployToScript) $(DSP) $(FinalDeployScriptFile) $(FinalTargetConnectionString) $(FinalTargetDatabase) $(ModelCollation) $(OutputPath) $(ProjectDir) $(ProjectName) $(ServerPropertiesFile) $(SolutionDir) $(SolutionExt) $(SolutionFileName) $(SolutionName) $(SolutionPath) $(SqlCommandVariablesFile)
Jun 24 '11 at 07:39 AM
xnl28
(comments are locked)
|

