Cannot save database project: *.dbp file in Visual Studio - database

I have a database project (.dbp) open in Visual Studio 2008 as part of a solution. I've added a new sql script to the project. When I try to save the database project so that I can check it in, VS shows me a dialog:
Some Unicode characters in this file could not be saved. To save all the information in this file, use 'Save As'; and select a Unicode encoding.
If I try to use "Save As.." I get exactly the same dialog.
I'm not very familiar with .dbp files, but I have opened the file in Notepad2 and re-encoded it. VS will reload the project but when I try check in the changes, VS says I need to save the file, and if I do, I once again get the above mentioned dialog.
Interestingly, I have no file association with the dbp file, but VS somehow mysteriously knows what to do with it in the context of a solution. Yet you can't open the dbp with VS on it's own. That broke my brain a little bit.
So I'm at a loss and going around in circles. If anybody can help, I'd appreciate it.

Not sure I know why this might have happened but it might be worth getting the previous version of the dbp file from source control and diffing the 2 to see if you can work out what's changed.

This is what I had to do to get around the problem, as there doesn't seem to be a fix that I can create, or find:
Edit the dbp file in an alternative text editor. Add a text entry for the entity that you want to add to the project. For example, to add a script called "Create users table.sql" to the "Changes" folder:
# Microsoft Developer Studio Project File - Database Project
Begin DataProject = "Database Project"
MSDTVersion = "80"
SccProjectName = "SAK"
SccLocalPath = "SAK"
SccAuxPath = "SAK"
SccProvider = "SAK"
Begin Folder = "Changes"
Script = "Create users table.sql"
End
End
Save the .dbp file and reload the project in Visual Studio.

Related

VScode setting change. Is there a way? [duplicate]

I have used WebStorm from JetBrains for almost four years now. It's a fantastic IDE for many reasons, but one of the best features is that it saves versions of files outside of version control. So if you accidentally delete files or lose files before they are saved by your version control system, WebStorm has a copy of them and there are visual diff tools to use. This feature has saved me on more than one occasion.
For Visual Studio Code, is there some feature/plugin that will auto-save copies of files as they change? Will Visual Studio Code save the files to some central location, or perhaps in the .vscode folder in the local workspace?
The feature in WebStorm is available from Local History → Show History from a folder or file. Here is an article about it:
Using Local History for code changes tracking
The view looks like:
You can go to menu File and choose Auto Save.
You can enable auto save with these methods:
Check the Auto Save item in the File menu
Go to Settings, search for auto save, and select the auto save option (afterDelay)
Auto save description in Visual Studio Code documentation
Yes, Visual Studio Code can auto-save changes on files as you make changes. It also allows you set a delay for how long to wait before saving the file.
Here's a link that should help you with that.
Or a shortcut you can simply navigate to your Visual Studio Code settings, and add the following to your settings.json file.
{
...
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000,
...
}
This will instruct your editor to autosave after a 1000 ms delay. You can set the autosave option to onFocusChange to autosave whenever you move your cursor away from the current text area.
There's a package called Local History that can be used to save a backup of your files outside version control.
You should check that out.
As of March 2022 (version 1.66), Visual Studio Code has a built-in feature called Local History that automatically creates commit-like versions of your files on every save.
It is enabled by default, but you can double check the setting workbench.localHistory.enabled to make sure it is enabled in your project.
From the reference:
Each local history entry contains the full contents of the file at the time the entry was created and in certain cases, can provide more semantic information (for example, indicate a refactoring).
From an entry you can:
Compare the changes to the local file or previous entry.
Restore the contents.
Delete or rename the entry.
The saved local versions are accessible from the Timeline section in the File Explorer tab.
Also, ensure you add .history to your .gitignore file, so Visual Studio Code doesn't track every change made to a single file as changes made to multiple files. This can be a problem and make your files changed so large even though it's a single file or a few files you made edits to.

SSIS package shows blank screen in design mode

I created a SSIS package using SQL Server data tools 2015 a week back.
And today i opened the package and it just shows the blank screen.
I read about this issue here and it seems that was the defect in earlier versions and it is fixed.
Did anyone face this issue in data tools 2015? How can i fix it and save my package?
1) While the package is opened with the white page, rename it in the solution.
2) Save the package and close.
3) Rename the package back original name (while package is closed). This rename will open the package and hopefully set it back so that you can edit it.
This has worked for me, hopefully it will work for others.
All white on open? Just happens from time to time, the stuff is there just close and reopen Visual Studio always makes it come back for me.
But if not you could always find the dtsx file under it all in your users folder:
C:\Users\<yourusernamehere>\Source\Workspaces\<Projectworkspace>
copy it and then pull it back in by right clicking the SSIS Packages folder in Solution Explorer and add existing package see if you can see it then.
Tim's answer above helped but didnt work for me. Instead this worked in Visual Studio 2015:
Close the solution
Move the .dtsx file that will not open to another folder (ex: C:\Temp)
Rename the .dtsx file to the name you want
Open the solution - you should get a message that the package is missing.
In Solution Explorer, right-click on "SSIS Packages" and select "Add existing Package"
Package Location should be "File system". Click the "..." button and select the moved and renamed .dtsx file. click OK
The .dtsx file should now be added in the solution correctly named - and open for editing.
The rename and reopen trick worked for me. I also tried another way. I closed Visual Studio and then located the .suo file under the .vs folder. I deleted that and then reopened and the file reloaded.
I hope that isn't too dangerous an approach; it stops git changes being made when the rename is performed
I have tried the trick to rename the package. It works as long as I keep a new name, but when I rename the package back to its old name, the problem returns. Importing a new copy of the .dtsx file into the same (broken) project did not fix the problem. [Referring to answer by #Joe]
Here is the only solution that always works for me:
Create a new Visual Studio (or SSDT) solution.
At the new project dialogue, choose "Integration Services Import Project Wizard"
A wizard starts up [hit next if at optional "Wizard Introduction"]
At "Select Source" page choose "Integration Services Catalog"
Browse to server and the project deployment you need to fix
This works, but if your deployed SSIS package(s) was not up to date you need to continue with these two actions:
Delete the package(s) in the new (fixed) solution that are old.
Import the newer package(s) via "Add Existing Package" from the problematic solution
I suspect this happens due to a problem in the .database or .dtproj file.
I have just encountered this; solution opens but all blank and no sub folders or files in the Solution Explorer. Tried the above suggestions, but no luck. Right clicked on the solution name and selected 'Reload Project' and all good.
Hope this helps someone.
In the Solution Explorer right click on the .dtsx package file and then click on View Designer.

SQL Server Database Project dbml file is always modified [duplicate]

I'm running into a small but weird annoyance that seems to be happening to other people, too (for example, check out the revision history of SEDE). I have a SQL Server 2008 database project in Visual Studio 2010 that works properly. When I go to commit/checkin to source control, I'm told that my DB project's .dbmdl file has changed, even when I've made no changes to the project!
I'm not sure if the changes are triggered by building my solution (which also includes an ASP.NET MVC application and a unit test project) or by simply opening the DB project, but this is getting kind of annoying and is creating clutter in source control.
Is it possible to stop these changes from occurring, or get rid of the .dbmdl file whatsoever?
If you delete the .dbml file, it is rebuilt without errors or warnings, so I think it's just a cache file for references, intellisense, etc. I'm going to exclude it from source control.
I believe Visual Studio serializes the dbmdl file every time the project is opened. The only possible work around would be to keep the project open.
See related question here. The .dbmdl file is unique per user (and some kind of cache, as said above) and so the right solution is indeed to exclude it from source control.

How to get logs into the Tool Log in Release Management for Visual Studio

In the Release Management for Visual Studio Deployment log, which can be found under the Details button found when viewing the details of a release, there are a number of columns.
The last three of these are Tool Log, Command Output and Status.
I have never seen anything in Tool Log, but I am in the situation now where I have a component running tests using vstest.console.exe.
Under "Command Output", I see the output from this program as it appears in the console window. However, vstest.console.exe can also be instructed to create a test log (a .trx file), which I would like to view under Tool Log. But I have no idea how to make this happen.
How do I get a log to appear under the Tool Log column?
The answer, it seems, is to set the "Log File Name" in the Tool definition to whatever log file you wish to view (in my case, the .trx file).
This obviously requires that you are using a tool that defines this, or a custom one. Fortunately, I'm using a custom tool.
Your Tool have to copy/create the .trx file to/in the Tool's work directory (%LOCALAPPDATA%\Temp\RM\T\RM\\).
Don't forget to add .trx extesion to Administration -> Settings -> Approved File Extension List.

Why does my DB project's .dbmdl file change even when I make no changes to the project?

I'm running into a small but weird annoyance that seems to be happening to other people, too (for example, check out the revision history of SEDE). I have a SQL Server 2008 database project in Visual Studio 2010 that works properly. When I go to commit/checkin to source control, I'm told that my DB project's .dbmdl file has changed, even when I've made no changes to the project!
I'm not sure if the changes are triggered by building my solution (which also includes an ASP.NET MVC application and a unit test project) or by simply opening the DB project, but this is getting kind of annoying and is creating clutter in source control.
Is it possible to stop these changes from occurring, or get rid of the .dbmdl file whatsoever?
If you delete the .dbml file, it is rebuilt without errors or warnings, so I think it's just a cache file for references, intellisense, etc. I'm going to exclude it from source control.
I believe Visual Studio serializes the dbmdl file every time the project is opened. The only possible work around would be to keep the project open.
See related question here. The .dbmdl file is unique per user (and some kind of cache, as said above) and so the right solution is indeed to exclude it from source control.

Resources