SSRS Custom Assemblies could not be loaded under Visual Studio 2017 - reporting-services

I have just installed VS 2017 and moved my SSRS project from VS 2015 to 2017. I have a custom assembly which is working fine under VS 2015, but not 2017. It says
Error while loading code module: 'CustomLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Details: Could not load file or assembly 'CustomLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
I had exact same problem under VS 2015 and the solution was moving my custom dll under
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies
So, I have moved my custom dll under
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PrivateAssemblies
which I believe is the correct path for VS 2017 and check file/folder permissions and set them identical, but no way, it still throws same error.
What am I missing?

This now requires two locations for the dll - the first works for new VS2017 RS projects, but upgraded projects also need the dll in the second location:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\SSRS
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PrivateAssemblies

I too have run into this issue, what fixed it for me was doing what was mentioned above and also editing the RSPreviewPolicy.config located in
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsof‌​t\SSRS
I set PermissionSetName="FullTrust" in all of the < CodeGroup>< /CodeGroup>
blocks.

TLDR - C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\SSDTRS
I was having the same problem - try using the Fusion Assembly Binding Log Viewer to peer into what the problem is as per http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx
With "Log bind failures to disk" enabled (and restarting VS) the devenv.exe process folder in your log location should then produce log files when you recreate the problem. Part of what it will tell you is the various folder locations VS is checking for assemblies. My issue was that I hadn't copied a required assembly. You might also be having a problem with it not liking a specific version of a dll it is trying to load (for instance .Net 4 v 2), the logs will highlight that as well.
The viewer tool is pretty poor in terms of being able to sort columns. I found it much easier to just open C:\FusionLogs\Default\devenv.exe (where I had set C:\FusionLogs as the custom log path), sort by date modified and watch as new files were created when trying to add the data source.
In terms of which folder to use - I initially dropped them into PrivateAssemblies which worked for creating the data source / reports. However when it came to build the preview the report I then got another could not load assemblies message. Again using the log viewer, but this time in the PreviewProcessingService.exe folder the error suggests the only directory that checks for the assemblies is: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\SSDTRS - this location works for both creating and previewing reports.

Related

Error: Could not load file or assembly Microsoft.AnalysisServices.AdomdClientUI

I am newbie at analysis services. When I try to execute ssis package on command prompt with dtexec command, I get the error :
Could not load file or assembly Microsoft.AnalysisServices.AdomdClientUI.dll Version 13.0.0.0
I tried few solutions which I found internet but they didn't work.
Thanks for advice.
Edit 20180604: Cumulative Update 1 for SQL Server 2016 SP2 fixes the issue.
Pre-20180604 answer: There's now a workaround for this bug, published here:
There is a bug, it will probably be corrected in SP2 CU1 which I've
been told will be released at the end of the month. We got a
workaround suggestion from MS, but that was not enough.
In short: The provided workaround does not work as is, but I found out
what more to do so now it works on the server with SP2
Longer: The provided workaround does not work as is because it does
register the correct assembly and the correct version (v14), but when
the package is run it will still search for the previous version v13. I
have tested and this is the case even if I have SP2 on my laptop,
rebuild all in the SSIS project and deploy – it will still be v13 that
is search for. It does not help to register v13 of the assembly, since
that version does not have a method that is called, so that will just
lead to other error messages.
The resolution I made on the server is to put in a binding redirect in
the .NET machine.config so that v14 is used even though v13 is searched
for.
Step-by-step I did, run from an elevated CMD:
1: Register the assembly: "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\gacutil.exe" /i "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\Microsoft.AnalysisServices.AdomdClientUI.dll"
You should get message one assembly successfully registered in GAC.
2: (Optional) Verify registration:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\gacutil.exe" /l Microsoft.AnalysisServices.AdomdClientUI
You should see message it is version 14.0.0.0 registered
3: Configure version redirect in machine.config (be careful when
editing!!)
File to edit:
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config"
The element to add content to is
configuration/runtime
On the server I fixed it on, this element was completely empty, i.e.
<runtime/>
If it is not empty, of course keep what’s in the element and add the
assemblyBinding element seen below.
Change/add so that the whole element contains this instead:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.AnalysisServices.AdomdClientUI"
publicKeyToken="89845dcd8080cc91"
culture="neutral"/>
<bindingRedirect oldVersion="13.0.0.0"
newVersion="14.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
5: Save the file. The package should now work.
When a fix in CU1 is installed, these steps should be done:
1: Remove the above added assemblyBinding element and save the file
2: Remove the dll that was added to the GAC: "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\gacutil.exe" /u Microsoft.AnalysisServices.AdomdClientUI
In my server, "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\Microsoft.AnalysisServices.AdomdClientUI.dll" was version 13, so in step 1 v13 was being registered (you can check the version by right clicking/Properties and then clicking on Details tab).
To solve this I:
Unregistered v13 with "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\gacutil.exe" /u Microsoft.AnalysisServices.AdomdClientUI
Copied v14 from a computer with VS installed to "C:\Program Files\"
For step 1, I executed "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\gacutil.exe" /i "C:\Program Files\Microsoft.AnalysisServices.AdomdClientUI.dll"
The steps when the fix arrives remain the same (with the addition of deleting "C:\Program Files\Microsoft.AnalysisServices.AdomdClientUI.dll").
Note: if you're running your packages in 32-bit instead of 64-bit, the machine.config that needs to be edited is the one located at c:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
SQL_AS_ADOMD.msi includes Microsoft.AnalysisServices.AdomdClient.dll, but not Microsoft.AnalysisServices.AdmomdClientUI.dll.
Microsoft.AnalysisServices.AdmomdClientUI.dll is included in SQL Management Studio, but version 13.0.1700.441 that I had as a drop in replacement failed due a new method being invoked, and I have not been able to locate a matching SQL 2016 SP2 version. Presumably awaiting a hotfix from Microsoft now.
You can get the Microsoft.AnalysisServices.AdomdClientUI.dll from MS SQL Server Feature Pack component SQL_AS_ADOMD.msi.
Presumably you have SQL server 2016, so you can get it from the SQL 2016 Feature Pack.

Use a SSIS package as Template in SSDT for Visual Studio 2017 Community

. Hi everybody!, I'm running into a small problem.
I have VS 2017 Community Edition, I've installed SSDT (SQL Server Data Tools)
I've built an SSIS package (a generic one) and now I would like to use it as a template for future packages.
So, I was digging in the web, also here in StackOverflow and found for example this article:
Setting up SSIS Item Template in SQL Server Data Tools for Visual Studio 2012
I found lot of other articles in MS for example:
https://learn.microsoft.com/en-us/sql/integration-services/create-packages-in-sql-server-data-tools
others, etc. and followed up to the tee but, for some reason I can't make it work.
This is my folder structure for my VS installation
I've left out of the tree some folders that doesn't apply to the problem
I put my package in the places I found in the articles and didnt work.
Sometimes, in the articles mentioned folders that I didn't have so I created and tried but nothing also (so deleted this folders)
I'm really lost, I tried everything I read, and some "creative things" from my yard but no results.
Anyone has come through this or has some experience about this issue?
Anyone can help?
Thank you very much.
Best regards and Happy new year!!
Gabriel
Well based on the articles I've read and the help of #billinkc, I finally figured out where to put the package, I was missing something also, but I realised when I read #billinkc answer.
When you are on VS Community Version, you have to put the package in this path:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\SSIS\ProjectItems\DataTransformationProject\DataTransformationItems
The files you need to make it work are, a dtsx file (the package that will be the template) and a vsdir file which mainly needs to have this structure I used this values and worked fine:
YourPackageName.dtsx| |The name you want to appear|100|The description of the package| |21| |#44
You can check all the fields of the vsdir file in the MS documentation:
https://learn.microsoft.com/en-us/visualstudio/extensibility/internals/template-directory-description-dot-vsdir-files
So now I have it running!
Thanks for your help!!
I don't have 2017 installed but this appears to work for 2015 so if you don't mind being a guinea pig...
Close out all instances of Visual Studio
Copy your template package into Common7\IDE\PrivateAssemblies\ProjectItems\DataTransformationProject\DataTransformationItems
Open your SSIS project
Right click on the project and select Add, New Item and you should have your template package listed (TemplatePackage2)
For reference, below is what my folder structure looks like. Since I couldn't remember whether the package templates lived at DataTransformationProject or DataTransformationProject\DataTransformationItems, I put a copy of my template package in both, varying by name to see what was picked up in the editor
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\ProjectItems\DataTransformationProject\DataTransformationItems
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\ProjectItems\DataTransformationProject\DataTransformationProjectItems.vsdir
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\ProjectItems\DataTransformationProject\TemplatePackage.dtsx
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\ProjectItems\DataTransformationProject\DataTransformationItems\DtsProjectItems.vsdir
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\ProjectItems\DataTransformationProject\DataTransformationItems\TemplatePackage2.dtsx
General notes about templates
The first is that the only way to get to your template is through the click path described above. If I want to add a new package, my default click path is right click on SSIS Package and select "New SSIS Package"
Pre-2012, the internal IDs of components and the package would remain the same. BIDS Helper had functionality to address this. Why it mattered was if you were attempting to track performance for packages, if they all report the same GUID you're going to have a hell of a time discerning whether Data Flow Task that ran for 10 hours is the same one that normally takes 10 seconds or was a second (different) package executed.
Developers will need to be local administrators on their machine to deploy the template package(s) and you'll need a process to keep that up to date. That or you need to engage the network admins to get these copied to developer machines.
Finally, if I had template logic, I'd probably abstract that away into Biml and then use source control to ensure people are working with the current version and avoids the whole permission issue.

SSIS via MSBuild - Could not load ...DTSRuntimeWrap

I'm using the CodePlex-hosted Microsoft.SqlServer.IntegrationServices.Build project to build a DLL that contains the MSBuild tasks for building SSIS packages via MSBuild.exe.
I also am using an MSBuild proj file that's floating around the web.
More here:
https://speaksql.wordpress.com/2013/06/07/a-journey-to-db-deployment-automaton-ssis-build-using-msbuild/
I've opened the CodePlex project, disabled signing, switched it to 4.6.1 and built the DLL and corrected paths etc. and go it semi-working. However MSBuild spits this error:
Could not load file or assembly 'Microsoft.SqlServer.DTSRuntimeWrap, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
I've installed SSDT latest for Visual Studio 2015. I have various SQL Server editions installed on my dev PC. The DLL seems to be present; I've copied all I need into one folder for the moment.
Open the CodePlex project again and remove the reference to Microsoft.SqlServer.ManagedDTS.
Look on your local disk for the missing Microsoft.SqlServer.DTSRuntimeWrap.dll and note the version(s) you have available.
Now look on your disk for Microsoft.SqlServer.ManagedDTS.dll and note the version(s).
Re-add the reference but make sure you pick a DLL for which you also have the version of the 'wrap' available.
Now make sure those DLLs are (re)copied over into your working folder or whatever.
If you're still having problems, you may need to copy some files around so that MSBuild.exe can find them or edit/create a config file for MSBuild.
How to solve: Custom MSBuild task requires assembly outside of AppBase

Could not load file or assembly error on adding custom libraries in SSRS reports

I have created a custom library(CodeLibrary) which internally references the dlls Microsoft.TeamFoundation.Client and Microsoft.TeamFoundation.WorkItemTracking.Client.
I added this custom Dll codelibrary.dll to my SSRS report. and the expression of one of the field as
=codelibrary.codefunction.GetValue(1000)
codefunction is the class and GetValue is the method.
When I preview the report, I get the error "Error while loading code module: 'CodeLibrary,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null'. Could not load file or assembly 'CodeLibrary,Version1.0.0.0, Culture=neutral,PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
I am using VS2013, I have placed the custom library DLL in the path
C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies
I have tested the custom library with a WPF application and it works fine.
I am not able to figure out what is causing this error.
I didnt have to modify rssrvpolicy.config file.
I added the custom dll to the following paths and it worked:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies
C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer\bin
In visual studio 2015, I had to copy the dll to:
C:\Program Files (x86)\MSBuild\14.0\Bin
You should copy your custom library to the ReportServer\Bin folder ex: C:\Program Files\Microsoft SQL Server\MSRS10_50.R2\Reporting Services\ReportServer\bin
Then modify the rssrvpolicy.config in ReportServer folder, find "$CodeGen$" and add the following code
<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="CoDeMagSample"
Description="CoDe Magazine Sample. ">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSRS10_50.R2\Reporting Services\ReportServer\bin\YOURLIBRARY.dll"
/>
After that, Stop and Start Reporting Service from Reporting Service Configuration Manager.
Hope this help.
Adding - In Visual studio 2019, I copied the dll to:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\SSRS

LNK1104: cannot open file 'glut32.lib'

I am using "CUDA bu Example" book to get started with CUDA.
But when I included all header files given by book then got ERROR as
Error 1 error LNK1104: cannot open file 'glut32.lib' D:\book\book\LINK book
I am using Visual Studio 10
Please help me out of this
I found the same error while setting it up in Visual Studio 2010
However, I also found a fix and wanted to share it.
Just copy and paste the glut32.lib file to MicrosoftSDKs folder, as this is the default location of VC++ linker location. To be exact
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib
You probably have to build the "shrUtils_vs2010.sln" solution if you haven't done it.
The file is in "\path_to_SDK\NVIDIA GPU Computing SDK 4.2\shared" folder.
Copy the glut32.lib file from the lib folder in "cuda by example" to the folder below:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\lib\Win32
I have tested this solution and it worked for me in visual studio 2015
1: Copy glut32.dll to your project directory (where your source.cpp is)
2: Copy glut.h to C:\Program Files\Microsoft Visual Studio 14.0\Vc\Include\gl (gl folder should be created manually)
3: Copy glut32.lib to C:\Program Files\Microsoft Visual Studio 14.0\Vc\lib done.