Running a .sql file in VS Code using mssql extension - not executing when file saved to git versioned network folder - visual-studio-code

I'm using VS Code with the mssql extension - both installed this week so up-to-date.
I can connect to our sql-server.
I then right-click the database name and select 'New Query' and do the following:
SELECT 1
I then save the file onto a network drive, re-run the script and all is still good.
I then save the file into a git versioned folder and this now happens:
It does not return a result - the query cannot be cancelled from within Code and I need to close the application. Moreover any .sql files I have saved in this git versioned directory are not usable from within Code.
Anyone any ideas what is happening and how to solve it?
Edit the git directory is cloned and synced from an Azure DevOps Repo

Unsure why the following works and there are likely other solutions.
I deleted my local Repo.
Then in Azure DevOps I cloned the repo using the "Clone to VS" option.
The SQL scripts now execute fine.

Related

TFS Get latest version - delete local files when they deleted from remote TFS Repository

We are migrating a tfs repository (az devops cloud) to tfs (another organization, cloud also.)
when getting latest version from the source repository, the files that were deleted from the remote repo are not getting deleted in the local workspace.
We are using visual studio to manage our tfs files.
Our repository is something like 800 GB. so cloning again is not an option.
Steps i did :
Get Latest version - Did not delete the local files (if they deleted remote)
Compare (local to remote) - checkout - did not delete local files.
any thoughts here ?
Make sure you clean the workspace first before everything else.
Retry getting latest version after you clean.
In visual studio, you can check for pending deletes, if you find any, check them in to complete the deletion.
Then you can compare workspaces if none of the above work. Compare local and remote.
A last resort would be to manually delete the files (DANGEROUS move, make sure you have backup)

When I add a solution to source control in VS 2019 Azure Devops only the startup project gets added - how do I add the others?

I am working on a solution that has 14 projects (so far) in it. I added the solution to Azure Devops source control and can see that the solution and the startup project have the little locks in the solution explorer, also I can see the startup project files in the devops repo, but I can't see how to add the other projects. Obviously I messed up somewhere, since ideally the repo would contain a folder for the startup project rather than the files themselves, but I don't know how to "undo" the source control and reset my solution back to its original state.
Can someone tell me how to either fix the source control so that the master branch contains all of the projects in sub-folders (as per the visual studio folder structure) - i.e. how to move the startup project files in the devops repo to a sub-folder and how to add the other projects to their own sub-folders, or, failing that, how to undo the source control so that all of my solution files are back on my local hard disk?
Any advice will be appreciated.
You mentioned that you are using git. So when you DO NOT have local changes which are not pushed to your git server, that means everything is "synced".
Make a backup of your folder, just copy & paste everything!
You can just delete the .git folder. So you have no "link" to the git server anymore.
You can the link the "folder" again to your git server, with sth. like:
git remote add origin https://YOURNAME.visualstudio.com/YOURPROJECT.git
Other option is check your .gitignore file, maybe some of your projects are excluded.
When you are working with Visual Studio, can can also create a new empty solution and add the projects one by one. Also be sure that there is NO Filter in Project Explorer in Visual Studio.
You can also check your git changes, with git log or git status from any terminal or command line tool.

Github local repo with VS code : Too many changes

I have install Github Enterprise on a self-managed server. I am connecting to my Github repo through VS Code. Every time I open VS code:
1 - It's trying to connect automatically to my cloud repo (Which I would like to be able to manually connect)
2 - VS code is installed in Anaconda and it's detecting 5000 changes....all anaconda files on my local machine
Can anyone help me with this issue?
thank you
I guess you have Anaconda or a conda environment installed into your project folder? Then you have to add that folder to your .gitignore file.
In VSCode you can rightclick on one of the 5000 files, select "Add to .gitignore" from the context menu, then the file .gitignore opens and you can delete everything but the top folder from the new entry and then that folder will be ignored.
Btw., VSCode doesn't update your local git repository automatically but just checks, if there are new changes in your remote repo (github) or how far it is behind your local changes. You can see that in the VSCode status bar. If you want to actually change one of the repos you either have to "pull" or "push" manually.

How can I get TFS 2013 to detect files deleted in the file system?

When I delete a file in the file system, TFS 2013 will correctly show it as still being in version control, but the file will not show as pending delete, and committing changes does not remove the file from the server. If I go to Source Code Explorer, the deleted file shows up as being on the server, but if I try to delete it, I get an error saying The item could not be found in your workspace, which is also correct, but I need to delete the file and I can't find any way to do it. I really do NOT want to have to download each file and manually delete it.
So, how can I get TFS to detect files that are no longer on the local file system and remove them from the server?
Note, my workspace is local, not server. Many sources say that TFS should detect local deletes in a local workspace, but this does not seem to be true, at least, it's not what I'm seeing.
Update: I know that my workspace is local because here's the TFS Workspaces window:
If the changes are not being detected then your workspace is currently configured as a Server Workspace and not a Local Workspace.
If you edit your workspace, click Advanced, and switch the workspace type to Local.
Note: You can check the configuration by looking for the hidden $tf folder in the root of your workspace...
Use /deletes with the tfs power tool: http://blogs.msdn.com/b/buckh/archive/2005/11/16/power-toy-tfpt-exe.aspx#Online

Jenkins: FTP / SSH deployment, including deletion and moving of files

I was wondering how to get my web-projects deployed using ftp and/or ssh.
We currently have a self-made deployment system which is able to handle this, but I want to switch to Jenkins.
I know there are publishing plugins and they work well when it comes to uploading build artifacts. But they can't delete or move files.
Do you have any hints, tipps or ideas regarding my problem?
The Publish Over SSH plugin enables you to send commands using ssh to the remote server. This works very well, we also perform some moving/deleting files before deploying the new version, and had no problems whatsoever using this approach.
The easiest way to handle deleting and moving items is by deleting everything on the server before you deploy a new release using one of the 'Publish over' extensions. I'd say that really is the only way to know the deployed version is the one you want. If you want more versioning-system style behavior you either need to use a versioning system or maybe rsync that will cover part of it.
If your demands are very specific you could develop your own convention to mark deletions and have them be performed by a separate script (like you would for database changes using Liquibase or something like that).
By the way: I would recommend not automatically updating your live sites after every build using the 'publish over ...' extension. In case we really want to have a live site automatically updated we rely on the Promoted Builds Plugin to keep it nearly fully-automated but add a little safety.
I came up with a simple solution to remove deleted files and upload changes to a remote FTP server as a build action in Jenkins using a simple lftp mirror script. Lftp Manual Page
In Short, you create a config file in your jenkins user directory ~/.netrc and populate it with your FTP credentials.
machine ftp.remote-host.com
login mySuperSweetUsername
password mySuperSweetPassword
Create an lftp script deploy.lftp and drop it in the root of your .git repo
set ftp:list-options -a
set cmd:fail-exit true
open ftp.remote-host.com
mirror --reverse --verbose --delete --exclude .git/ --exclude deploy.lftp --ignore-time --recursion=always
Then add an "Exec Shell" build action to execute lftp on the script.
lftp -f deploy.lftp
The lftp script will
mirror: copy all changed files
reverse: push local files to a remote host. a regular mirror pulls from remote host to local.
verbose: dump all the notes about what files were copied where to the build log
delete: remove remote files no longer present in the git repo
exclude: don't publish .git directory or the deploy.lftp script.
ignore-time: won't publish based on file creation time. If you don't have this, in my case, all files got published since a fresh clone of the git repo updated the file create timestamps. It still works quite well though and even files modified by adding a single space in them were identified as different and uploaded.
recursion: will analyze every file rather than depending on folders to determine if any files in them were possibly modified. This isn't technically necessary since we're ignoring time stamps but I have it in here anyway.
I wrote an article explaining how I keep FTP in sync with Git for a WordPress site I could only access via FTP. The article explains how to sync from FTP to Git then how to use Jenkins to build and deploy back to FTP. This approach isn't perfect but it works. It only uploads changed files and it deletes files off the host that have been removed from the git repo (and vice versa)