Jamie Thomson

Hello,

A few weeks ago I commented out the call to LinkedServers.sql from Script.PreDeployment.sql. So, my Script.PreDeployment.sql file looked like this:

1 :r .\Logins.sql

2

3 --:r .\LinkedServers.sql

4

5 :r .\CustomErrors.sql

6

7 :r .\EncryptionKeysAndCertificates.sql

I noticed later that the file looks like this:

1 :r .\Logins.sql

2

3 --:r .\LinkedServers.sql

4

5 :r .\CustomErrors.sql

6

7 :r .\EncryptionKeysAndCertificates.sql

8

9 :r .\LinkedServers.sql

As you can see, the line ":r .\LinkedServers.sql" has gotten added somehow. I promise you that it wasn't done my anyone on the team, datadude put it there somehow. I can doubly sure of that because this has happened twice now.

I can confirm that the change has taken place without our knowledge because we are using TFS as our source control system and I can go back and verify that the penultimate version does not have this extra line in there. The most recent version was checked in following one of my colleagues doing a schema compare and writing updates.

Surely this is a bug Why is datadude editing Script.PreDeployment.sql during schema compare/write updates without telling us

This has caused us lots of problems. LinkedServers.sql does actually contain some code although we don't actually want to run that code as part of our build - hence the line has been commented out of Script.PreDepolyment.sql.The fact that this code was getting called has caused our continuous integration builds to fail.

Thanks

Jamie




Re: Visual Studio Team System - Database Professionals Datadude bug: Call to LinkedServers.sql automatically gets added to Script.PreDeployment.sql

Alle

Hi Jamie,

In my experience to date, I have found that it is VERY dangerous and unreliable to change the predefined scripts. They have certain content that the IDE expects (such as the calls to standard scripts / items) and as such will at certain times be reentered even it they were manually deleted. I'm not sure if this is only in the Pre- and PostDeployment.sql files or if the other standard scripts (Login.sql, etc.) are also affected.

I would first assume the latter and ask the team to confirm this.

In DataDude at least your additions (i.e. :r includes) are not overwritten / deleted but this is more the exception than the rule with VS generated scripts / code.

The solution / work around is to ensure that nothing is causing entries you do not want in the LinkedServers.sql or other standard script files. That way they can be called without damage. The best way would certainly be to exclude unwanted objects / references from the build since I am not 100% sure that commenting out entries in LinkedServers.sql might not also be regenerated when least expected.

Again, I would appreciate comments on this from the team.

Alle





Re: Visual Studio Team System - Database Professionals Datadude bug: Call to LinkedServers.sql automatically gets added to Script.PreDeployment.sql

Jamie Thomson

Alle,

Good to know someone else has experienced the same. Do you agree with me that this isa bug

-Jamie






Re: Visual Studio Team System - Database Professionals Datadude bug: Call to LinkedServers.sql automatically gets added to Script.PreDeployment.sql

Jamie Thomson

Hello,

Could someone on the datadude team address this please

Thanks

Jamie






Re: Visual Studio Team System - Database Professionals Datadude bug: Call to LinkedServers.sql automatically gets added to Script.PreDeployment.sql

Liangxiao Zhu - MSFT

Hi,

When you run SchemaCompare to update the project, is there any new linked server found and gets write to the LinkedServers.sql file

Thanks,

Liangxiao






Re: Visual Studio Team System - Database Professionals Datadude bug: Call to LinkedServers.sql automatically gets added to Script.PreDeployment.sql

Jamie Thomson

Liangxiao Zhu - MSFT wrote:

Hi,

When you run SchemaCompare to update the project, is there any new linked server found and gets write to the LinkedServers.sql file

Thanks,

Liangxiao

Hi Liangxiao,

Can't remember to be honest. I'm not in the office today so I'll try it on Monday.

Regardless of the answer though - this shouldn't happen. If I've commented it out then I've commented it out for a reason.

-Jamie






Re: Visual Studio Team System - Database Professionals Datadude bug: Call to LinkedServers.sql automatically gets added to Script.PreDeployment.sql

Liangxiao Zhu - MSFT

Hi Jamie,

Since those includes are auto generated during importing. While importing if we have imported statements for linked server, then we try to add an include entry in the PreDeployment.sql file. At that time, we can not tell, if the includes entry was deleted or commented on purpose or it was not there originally that we should add one.

Liangxiao






Re: Visual Studio Team System - Database Professionals Datadude bug: Call to LinkedServers.sql automatically gets added to Script.PreDeployment.sql

Jamie Thomson

Liangxiao Zhu - MSFT wrote:

Hi Jamie,

Since those includes are auto generated during importing. While importing if we have imported statements for linked server, then we try to add an include entry in the PreDeployment.sql file. At that time, we can not tell, if the includes entry was deleted or commented on purpose or it was not there originally that we should add one.

Liangxiao

Liangxiao,

Thanks for the reply.

I think that's dangerous - the line has been commneted out for a reason.

Why can you not to check to see if the line exists and has been commented out

-Jamie






Re: Visual Studio Team System - Database Professionals Datadude bug: Call to LinkedServers.sql automatically gets added to Script.PreDeployment.sql

Alle

Hi Liangxiao, hi Jamie,

I've been watching this thread a while (and was expecting the answer Liangxiao gave). I am familiar with this functionality in other VS areas. As Monk says - "It's a blessing and a curse!".

I would suggest that the functionality can be lived with if it is known before hand. The only way I can see to insure that the user is aware of this, would be to add a UI generated comment block before and after the generated stubs in the pre- and postdeployment files with a warning indicating these lines are generated and should / can not be changed by the user since they could be overwritten / regenerated at any time. User entries in these files should be made outside of that block / region.

This would be conform with other configuration files / generated code that has been used by the VS UI in the past.

Jamie's suggestion would also be good, but I can see the possible limitations / problems involved if someone "didn't do a standard comment out" or deleted it entirely (was it there or not ).

Alle





Re: Visual Studio Team System - Database Professionals Datadude bug: Call to LinkedServers.sql automatically gets added to Script.PreDeployment.sql

Jamie Thomson

Alle wrote:

Jamie's suggestion would also be good, but I can see the possible limitations / problems involved if someone "didn't do a standard comment out" or deleted it entirely (was it there or not ).

Alle

Alle,

I can't agree with that. All they need to do is search the predeployment script and if it contains a string r: .\LinkedServers.sql - don't add it in. I don't see why its that difficult.

The current behaviour is stupid. Unfortunately no-one seems to agree with me.

-Jamie






Re: Visual Studio Team System - Database Professionals Datadude bug: Call to LinkedServers.sql automatically gets added to Script.PreDeployment.sql

Liangxiao Zhu - MSFT

Hi Jamie,

I understand your concern. But as Alle pointed out, other user can manually comment that includes line in a none standard format, and also they can manually delete that line entirely. For that situation, it will be hard for us to guess user's intention. Also there is another scenario, if a user imported schema first, then figure out nothing is in LinkedServers.sql file, so he comment out the includes line in PreDeployment.sql file. Then later on, he imports a script including statements for Linked Server, at that time, should we add that includes line back or not. I think we should add it back.

Thanks,

Liangxiao






Re: Visual Studio Team System - Database Professionals Datadude bug: Call to LinkedServers.sql automatically gets added to Script.PreDeployment.sql

Jamie Thomson

Liangxiao Zhu - MSFT wrote:

Hi Jamie,

I understand your concern. But as Alle pointed out, other user can manually comment that includes line in a none standard format, and also they can manually delete that line entirely. For that situation, it will be hard for us to guess user's intention. Also there is another scenario, if a user imported schema first, then figure out nothing is in LinkedServers.sql file, so he comment out the includes line in PreDeployment.sql file. Then later on, he imports a script including statements for Linked Server, at that time, should we add that includes line back or not. I think we should add it back.

Thanks,

Liangxiao

Liangxiao,

Thanks for the reply.

I guess this is where we disagree. I come from the school of thought that says "don't change anything without telling the user". In this case the change to Script.Predeployment.sql is completely invisible. I wasn't here on the day in question and it tied 2 of our guys up for a full day trying to work out why our deploy was failing - and at the ed of that day they hadn't worked it out.

If there are linked servers to import than sure - import them. But don't change Script.Predeployment.sql. Its far easier to trace why the linked servers are not getting created when you think they should be as opposed to trying to trace why your deploy is failing and you have no idea why. Trust me on this one Smile

Always always put the responsibility for changing stuff in the hands of the user - never change something without telling them. That's simply my opinion based on experience.

Regards

-Jamie