Why is my script task losing references?
I have a script task that needs to use the System.Xml.Linq library. I add the reference under the project > references folder in the Project explorer, then I add the "using" statement in the code (with C#). All looks well at this point. However, when I re-open the script task, the reference is gone from the project explorer, and errors appear in the code where I was using it. I have a project where this works correctly, and does not, lose the reference. However, on the two projects I'm creating now, it is happening. Thoughts? Clint
July 22nd, 2011 1:18pm

Can you verify that System.Xml.Linq.dll is in both the .NET folder and the GAC?
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 1:32pm

Can you tell me where those are located? My .net skills are sub-par these days :) We're running Windows server 2008 R2 enterprise, if that helps.Clint
July 22nd, 2011 2:29pm

sounds stupid, but have you pressed save after adding the reference?Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 2:32pm

I did :)...no luck.Clint
July 22nd, 2011 2:33pm

The GAC is C:\Windows\assembly .NET Framework is either: C:\Windows\Microsoft.NET\Framework\v3.5 or C:\Windows\Microsoft.NET\Framework\v4.0.30319 depending on what version of the .NET Framework you are using. Linq is only available in the .NET Framework 3.5 and up. SSIS uses the .NET Framework 2.0 by default, so it makes sense that you can't reference it. When I look at my script tasks, it isn't even available as selectable (greyed out). Have you tried changing the target framework? Did it actually show up in your references under the project?
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 2:47pm

I have another package where I do this exact thing, and it works. I change the target framework, add the reference, then all is well. Here's what I think the problem is: In the referenced list, it says system.xml.linq is in framework 3.5, and when I target that, the assembly become "un-greyed" in the list, and I can add it (although it disappears next time, as mentioned before). However, when I look in the Microsoft.Net framework folders, system.xml.linq appears in the 4.0 framework, not 3.5 ...SSIS won't allow me to select 4.0 seems a little strange...Clint
July 22nd, 2011 3:07pm

I have another package where I do this exact thing, and it works. I change the target framework, add the reference, then all is well. Here's what I think the problem is: In the referenced list, it says system.xml.linq is in framework 3.5, and when I target that, the assembly become "un-greyed" in the list, and I can add it (although it disappears next time, as mentioned before). However, when I look in the Microsoft.Net framework folders, system.xml.linq appears in the 4.0 framework, not 3.5 ...SSIS won't allow me to select 4.0 seems a little strange... Clint It's not possible to use a .Net framework 4 dll! 3.5 is the highest version possible. But there is a 3.5 version of that: http://msdn.microsoft.com/en-us/library/system.xml.linq(v=VS.90).aspx Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 3:11pm

I believe it has to be present in the 3.5 .NET folder also. See this link: http://consultingblogs.emc.com/jamiethomson/archive/2005/11/02/2341.aspx
July 22nd, 2011 3:13pm

Thanks. I realize you can't use 4.0. I have two concerns: 1) I have 3.5 installed, but that assembly isn't in there. Why not? 2) Is it safe to re-install 3.5 if 4.0 is already installed? If so, how do you do it on Server 2008R2, since it's a feature you turn on, and you don't have to download. Can you still download anyway? Clint
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 3:32pm

Thanks. I realize you can't use 4.0. I have two concerns: 1) I have 3.5 installed, but that assembly isn't in there. Why not? 2) Is it safe to re-install 3.5 if 4.0 is already installed? If so, how do you do it on Server 2008R2, since it's a feature you turn on, and you don't have to download. Can you still download anyway? Clint Reinstall should be no problem if 4.0 is already installed. There is also a service pack for 3.5 available: http://www.microsoft.com/download/en/details.aspx?id=22Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com
July 22nd, 2011 3:35pm

Unfortunately, I don't know the answer to that. I suspect it's just a DLL registration problem you're encountering. Take a look at this: http://blogs.msdn.com/b/sqlblog/archive/2010/01/08/how-to-install-net-framework-3-5-sp1-on-windows-server-2008-r2-environments.aspx I hope this helps.
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 3:45pm

Actually, I built the code project (not the SSIS package), and then the reference stuck. Normally I just run it, and it saves it, but for some reason building it solved the problem. Thanks all!Clint
August 4th, 2011 1:31pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics