<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www2.sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Visual Studio 2010 and SQLCLR: Some Good, Some Bad</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2010/05/02/visual-studio-2010-and-sqlclr-some-good-some-bad.aspx</link><description>This past week I've been trying out Visual Studio 2010 for SQLCLR development. Verdict: A couple of nice things, a couple not so nice. In the interest of keeping things somewhat positive around here, we'll start with the good stuff : Pre-deployment and</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>re: Visual Studio 2010 and SQLCLR: Some Good, Some Bad</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2010/05/02/visual-studio-2010-and-sqlclr-some-good-some-bad.aspx#24759</link><pubDate>Mon, 03 May 2010 04:47:13 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:24759</guid><dc:creator>Uri Dimant</dc:creator><description>&lt;p&gt;Hi Adam&lt;/p&gt;
&lt;p&gt;Do you use VS2010 Ultimate 32 bit?&lt;/p&gt;
&lt;p&gt;Ah lets see whether triple-posting issue is still exists.&lt;/p&gt;
</description></item><item><title>re: Visual Studio 2010 and SQLCLR: Some Good, Some Bad</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2010/05/02/visual-studio-2010-and-sqlclr-some-good-some-bad.aspx#30212</link><pubDate>Fri, 05 Nov 2010 19:00:52 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:30212</guid><dc:creator>Andries</dc:creator><description>&lt;p&gt;Good Feedback!&lt;/p&gt;
&lt;p&gt;Another thing I noticed is debugging (using VS 2010) clr's using &amp;quot;attach to process&amp;quot; for complex assemblies, instead of debugging with auto-deploy and test scripts is a no-go.. sql just hangs, until you detach..&lt;/p&gt;
&lt;p&gt;Also tried adding a config file to sqlservr.exe forcing the correct debugger, but this does not work either..&lt;/p&gt;
&lt;p&gt;Not cool Microsoft!&lt;/p&gt;
</description></item><item><title>re: Visual Studio 2010 and SQLCLR: Some Good, Some Bad</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2010/05/02/visual-studio-2010-and-sqlclr-some-good-some-bad.aspx#32320</link><pubDate>Tue, 04 Jan 2011 16:16:49 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:32320</guid><dc:creator>Beata</dc:creator><description>&lt;p&gt;Thanks so much for this post, specially the framework version issue (bad stuff) nearly saved my life!&lt;/p&gt;
</description></item><item><title>re: Visual Studio 2010 and SQLCLR: Some Good, Some Bad</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2010/05/02/visual-studio-2010-and-sqlclr-some-good-some-bad.aspx#35436</link><pubDate>Thu, 05 May 2011 01:59:54 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:35436</guid><dc:creator>Rich</dc:creator><description>&lt;p&gt;I'm reading this about a year later -- thanks for a great series of articles, Adam!&lt;/p&gt;
&lt;p&gt;I've discovered a very annoying aspect of deployment of CLR in VS 2010: &amp;nbsp;if you try to deploy into a &amp;quot;large&amp;quot; DB with thousands of objects, it hangs forever.&lt;/p&gt;
&lt;p&gt;See: &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/b/psssql/archive/2011/01/24/deploying-clr-assembly-hangs-with-visual-studio-2010.aspx"&gt;http://blogs.msdn.com/b/psssql/archive/2011/01/24/deploying-clr-assembly-hangs-with-visual-studio-2010.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The hack work-around suggested is to deploy to a small database, then edit the deployment scripts to change the database. &amp;nbsp;This was ridiculous: it's easier and more straightforward to create my own T-SQL script to drop and create the assembly and functions directly.&lt;/p&gt;
&lt;p&gt;As Andries said above: Not cool Microsoft!&lt;/p&gt;
</description></item><item><title>re: Visual Studio 2010 and SQLCLR: Some Good, Some Bad</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2010/05/02/visual-studio-2010-and-sqlclr-some-good-some-bad.aspx#40673</link><pubDate>Wed, 28 Dec 2011 20:12:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:40673</guid><dc:creator>Gokhan Varol</dc:creator><description>&lt;p&gt;Hi Adam, happy holidays.&lt;/p&gt;
&lt;p&gt;I came across to the loopback connection c# script in one of your posts. I really like the concept, I used to pass ServerName, database name to each clr proc or function. I added the script to my project. It builds fine. I am using VS2010 with SP1 against a SQL 2008 SP3 database. For some reason it does not let me deploy it. I boiled it down to static variable &amp;quot;private static readonly string connection_string;&amp;quot;, if I make it private only (no static) it deploys fine. I searched around quite a bit what the cause will be with no luck. I figured you may already run into the similar problem or so.&lt;/p&gt;
&lt;p&gt;By the way I started following your blog (starting following some blogs couple months ago and got addicted now ;-)). I like efficient coding and directly applied your string splitting, whoisactive, xtended events etc, just awesome. We are here in Miami, and my company does not have the habit of flying people for classes. Anyway whenever I get a chance I'd like a week long sql education ;-)&lt;/p&gt;
&lt;p&gt;Happy holidays&lt;/p&gt;
&lt;p&gt;The script is below.&lt;/p&gt;
&lt;p&gt;using System;&lt;/p&gt;
&lt;p&gt;using System.Collections.Generic;&lt;/p&gt;
&lt;p&gt;using System.Text;&lt;/p&gt;
&lt;p&gt;using System.Data.SqlClient;&lt;/p&gt;
&lt;p&gt;static class connection_builder&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;private static readonly string connection_string;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;static connection_builder()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;using (var local_conn = new SqlConnection(&amp;quot;context connection = true&amp;quot;))&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;local_conn.Open();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var comm = new SqlCommand();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;comm.Connection = local_conn;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;comm.CommandText =&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;@&amp;quot;SELECT &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;@server_name = @@SERVERNAME, &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;@db_name = DB_NAME()&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;comm.Parameters.Add(&amp;quot;@server_name&amp;quot;, System.Data.SqlDbType.VarChar, 128).Direction = System.Data.ParameterDirection.Output;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;comm.Parameters.Add(&amp;quot;@db_name&amp;quot;, System.Data.SqlDbType.VarChar, 128).Direction = System.Data.ParameterDirection.Output;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;comm.ExecuteNonQuery();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SqlConnectionStringBuilder sb = new SqlConnectionStringBuilder();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sb.DataSource = (string)comm.Parameters[0].Value;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sb.InitialCatalog = (string)comm.Parameters[1].Value;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sb.IntegratedSecurity = true;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sb.Enlist = false;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;connection_string = sb.ConnectionString;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;public static SqlConnection get_loopback_connection()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return (new SqlConnection(connection_string));&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;------ Build started: Project: UtilClr, Configuration: Debug Any CPU ------&lt;/p&gt;
&lt;p&gt; &amp;nbsp;UtilClr -&amp;gt; C:\Users\gvarol\Documents\Util\UtilClr\bin\Debug\UtilClr.dll&lt;/p&gt;
&lt;p&gt;------ Build started: Project: Util, Configuration: Debug Any CPU ------&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Util -&amp;gt; C:\Users\gvarol\Documents\Util\Util\sql\debug\Util.dbschema&lt;/p&gt;
&lt;p&gt;------ Deploy started: Project: Util, Configuration: Debug Any CPU ------&lt;/p&gt;
&lt;p&gt;C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.TSqlTasks.targets(120,5): Error MSB4018: The &amp;quot;SqlDeployTask&amp;quot; task failed unexpectedly.&lt;/p&gt;
&lt;p&gt;System.ArgumentOutOfRangeException: Index and count must refer to a location within the buffer.&lt;/p&gt;
&lt;p&gt;Parameter name: bytes&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at System.Text.DecoderNLS.GetCharCount(Byte[] bytes, Int32 index, Int32 count, Boolean flush)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at System.Text.DecoderNLS.GetCharCount(Byte[] bytes, Int32 index, Int32 count)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.Data.Schema.Sql.SchemaModel.ClrAssemblyReader.ClrAssemblyMetaData.GetStringFromStringStream(Int32 offset)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.Data.Schema.Sql.SchemaModel.ClrAssemblyReader.ClrAssemblyMetaData..ctor(BinaryReader binaryReader)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.Data.Schema.Sql.SchemaModel.ClrAssemblyReader.ClrAssemblyMetaDataCache.Add(ISql90Assembly assembly)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.Data.Schema.Sql.Build.SqlDeploymentPlanGenerator.AssemblyAnalyzer.GetDifferenceOperations(ISql90Assembly sourceAssembly, ISql90Assembly targetAssembly)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.Data.Schema.Sql.Build.SqlDeploymentPlanGenerator.AssemblyAnalyzer.AnalyzeAlter(IModelElement sourceElement, ModelComparisonChangeDefinition change)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.Data.Schema.Sql.Build.SqlDeploymentPlanGenerator.PlanMediator.CollectChangesFromAlters(Dictionary`2 proposedChanges)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.Data.Schema.Sql.Build.SqlDeploymentPlanGenerator.PlanMediator.BuildOperations()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.Data.Schema.Sql.Build.SqlDeploymentPlanGenerator.OnGeneratePlan()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.Data.Schema.Build.DeploymentPlanGenerator.GeneratePlan()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.Data.Schema.Build.SchemaDeployment.BuildPlan()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.Data.Schema.Build.SchemaDeployment.Execute(Boolean executeDeployment)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.Data.Schema.Build.SchemaDeployment.Execute()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.Data.Schema.Tasks.DBDeployTask.Execute()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean&amp;amp; taskResult)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Done executing task &amp;quot;SqlDeployTask&amp;quot; -- FAILED.&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Done building target &amp;quot;DspDeploy&amp;quot; in project &amp;quot;Util.dbproj&amp;quot; -- FAILED.&lt;/p&gt;
&lt;p&gt; Done executing task &amp;quot;CallTarget&amp;quot; -- FAILED.&lt;/p&gt;
&lt;p&gt;Done building target &amp;quot;DBDeploy&amp;quot; in project &amp;quot;Util.dbproj&amp;quot; -- FAILED.&lt;/p&gt;
&lt;p&gt;Done building project &amp;quot;Util.dbproj&amp;quot; -- FAILED.&lt;/p&gt;
&lt;p&gt;Build FAILED.&lt;/p&gt;
&lt;p&gt;========== Build: 2 succeeded or up-to-date, 0 failed, 0 skipped ==========&lt;/p&gt;
&lt;p&gt;========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========&lt;/p&gt;
</description></item><item><title>re: Visual Studio 2010 and SQLCLR: Some Good, Some Bad</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2010/05/02/visual-studio-2010-and-sqlclr-some-good-some-bad.aspx#40679</link><pubDate>Thu, 29 Dec 2011 10:48:37 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:40679</guid><dc:creator>Gokhan Varol</dc:creator><description>&lt;p&gt;Please ignore my issue above, it was related to some other object in my database, dropping clr objects and the assembly once from the database solved it.&lt;/p&gt;
</description></item><item><title>re: Visual Studio 2010 and SQLCLR: Some Good, Some Bad</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2010/05/02/visual-studio-2010-and-sqlclr-some-good-some-bad.aspx#44266</link><pubDate>Wed, 11 Jul 2012 23:01:33 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:44266</guid><dc:creator>Justin Dearing</dc:creator><description>&lt;p&gt;If you use the command line (msbuild foo.csproj /T:deploy) you get a hint indicating that it might be a .NET Runtime version issue:&lt;/p&gt;
&lt;p&gt;	SqlClrDeploy:&lt;/p&gt;
&lt;p&gt;	 &amp;nbsp;Beginning deployment of assembly MySqlClrProject.dll to server . : dropme&lt;/p&gt;
&lt;p&gt;	 &amp;nbsp;The following error might appear if you deploy a SQL CLR project that was built for a version of the .NET Framework that is incompatible with the target instance of SQL Server: &amp;quot;Deploy error SQL01268: CREATE ASSEMBLY for assembly failed because assembly failed verification&amp;quot;. To resolve this issue, open the properties for the project, and change the .NET Framework version.&lt;/p&gt;
&lt;p&gt;	 &amp;nbsp;Deployment script generated to:&lt;/p&gt;
&lt;p&gt;	 &amp;nbsp;c:\Users\jdearing\Documents\MySqlClrProject\bin\Debug\MySqlClrProject.sql&lt;/p&gt;
&lt;p&gt;If you want to show that message in the output panel of Visual Studio you can tune the verbosity settings. In the Options dialog select the Build and Run settings below the Projects and Solutions node.&lt;/p&gt;
&lt;p&gt;For more information see these stackoverflow questions:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://stackoverflow.com/questions/7634794/how-do-i-deploy-a-clr-stored-procedure-via-the-msbuild-command-line/11441709#11441709"&gt;http://stackoverflow.com/questions/7634794/how-do-i-deploy-a-clr-stored-procedure-via-the-msbuild-command-line/11441709#11441709&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://stackoverflow.com/questions/7557562/how-do-i-get-the-message-msbuild-task-that-shows-up-in-the-visual-studio-proje"&gt;http://stackoverflow.com/questions/7557562/how-do-i-get-the-message-msbuild-task-that-shows-up-in-the-visual-studio-proje&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>