Crystal Reports in Visual Studio 2017 - asp.net-mvc

I have a MVC .Net application that uses a Crystal Report to return a PDF file. It was working ok, but I wanted to install the most recent version of the runtime on the server to see if it would correct an issue with fonts that I was experiencing.
The server is Windows Server 2008 R2, and I installed the most recent version of CR for VS from the SAP website. This installed two things on the server: SAP Crystal Reports runtime engine for .NET Framework (64-bit) 13.0.21.2533, and SAP Crystal Reports, version for Visual Studio 13.0.21.2533.
My Visual Studio project has the following Nuget packages installed: CrystalDecisions.CrystalReports.Engine, CrystalDecisions.Shared, CrystalDecisions.ReportSource, CrystalDecisions.Web.
Now when I try to access this page and generate the PDF, I get the following server error:
Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
I'm not finding any coherent info online as to why this error is appearing or how to resolve it aside from copying DLLs to the bin folder. I tried adding a couple of Nuget packages relating to CrystalDecisions.ReportAppServer. There is not a Copy Local option for the DLL reference, so I tried to manually copy the DLL from the Nuget packages folder for the project and paste them into the bin folder, but that didn't lead anywhere except more errors that I couldn't resolve.
The documentation on this stuff is horrible and confusing, when it seems like it should be pretty straightforward, as I said this was already working before I upgraded the runtime and CR for VS.
Are the Nuget packages maybe not compatible with this newer version? On this SAP blog post, it mentions "As most of CR/RAS .NET Assemblies are now re-versioned from 13.0.2000.0 to 13.0.3500.0, user MUST remove all old CR assemblies from Reference list and add the new version of CR assemblies, then rebuild the application.", but I do not know where to get these assemblies aside from using the Nuget packages.

Please download all the packages of crystal reports 13.0.21. You have to download all packages are given below.
CrystalDecisions-CrystalReports-Engine
CrystalDecisions-ReportSource
CrystalDecisions-Shared
CrystalDecisions-Web
CrystalDecisions-ReportAppServer

Related

Cannot create Q# projects

I'm new to quantum computing and I've been trying to follow instructions on https://learn.microsoft.com/en-us/azure/quantum/install-command-line-qdk?tabs=tabid-vscode to dive into this field, but I've run into a problem. Every time I'm trying to create a new Q# application project, I get the following error message
The project file cannot be opened. Unable to find package Microsoft.Quantum.Sdk. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages C:\Program Files\dotnet\sdk\5.0.202\Sdks\Microsoft.Quantum.Sdk\Sdk not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.
and I can't find that package myself either.
I've tried to install Microsoft.Quantum.Development.Kit-0.16.2104.138035 several times, with both .NET 3.1.408 and 5.0.202. I'm using VS 2019 16.9.4 Community Edition on Windows 10.
Looks like nuget.org is not listed as a valid package source in your computer, so dotnet can't find the QDK packages online.
Try running this command:
dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
And then try building your Q# project again.
It's unclear to me why nuget.org is not listed as a source, though; it should be included by default when you install the .NET Core.

Cannot create Q# Quantum Application in Visual Studio

I'm going to create Q# application for the first time. I installed the "Microsoft Quantum Development Kit" and I have .not core 3.1.301 (the latest)
I use VS 2019 Community Edition.
In VS, I see the Q# Application when creating new solution but when I try to create , I get below error:
The project file cannot be opened by the project system, because it is
missing some critical imports or the referenced SDK cannot be found.
Detailed Information: The SDK resolver "NuGetSdkResolver" failed to
run. Unable to find fallback package folder
'C:\Microsoft\Xamarin\NuGet\'.
C:\Program Files\dotnet\sdk\3.1.301\Sdks\Microsoft.Quantum.Sdk\Sdk not
found. Check that a recent enough .NET Core SDK is installed and/or
increase the version specified in global.json.
I could not find any solution over the web.
The Quantum.SDK is not distributed with the extension, instead is downloaded the first time you try to build/create the Q# application.
Looks like Visual Studio is having problems downloading it using NuGet. I can think of two reasons:
1. You are not connected to the internet, so it can't connect to nuget.org to download the package
2. The error points to a missing "C:\Microsoft\Xamarin\NuGet\", I would suggest creating this folder.

msbuild error building sql clr dll in TFS

We have SQL CLR dll that we developed quite a long time ago that we have been using. Unfortunately it wasn't ever in our normal daily builds.We are going to be upgrade our sql server from 2008 R2 to 2014. So i opened the project and upgrade it to a visual studio 2013 project (we hadn't opened it for quite some time). I also upgrade the target framework from 3.5 to 4.5.1. Lastly i changed the target sql server version to 2014. I was able to build it locally. I then tried to add it to our TFS build and got the following error:
E:\Builds\8\TRSApps\Dev\Sources\Shared
Objects\Components\FrsSqlCLR\VB Code\FrsSqlCLR.vbproj (76): The
imported project "C:\Program Files
(x86)\MSBuild\12.0\bin\amd64\SqlServer.targets" was not found. Confirm
that the path in the declaration is correct, and that the
file exists on disk.
I was able to resolve the problem. I searched for "SqlServer.targets" locally and found it under the .net 3.5 framework folder (not under 4.x):
C:\Windows\Microsoft.NET\Framework\v3.5
I just copied it to the location it was looking for it above and it fixed the problems which leads me to my questions:
Is TFS looking for SqlServer.targets in the correct location? If so then why isn't SqlServer.targets there?
Is there something i need to install on the build machine?
Why is the file in the 3.5 framework folder and not in the 4.x framework folder
Though i was able to resolve it by copying it from the 3.5 framework folder it seem a kind of hacky solution. I want the details so in the future when we upgrade our tfs server i have all the details.
You need to install Visual Studio 2013 on the build server. Also Sql Server Data Tools for 2013.
Once you have them on the build server it should build as is.

VS 2010, TFS 2013 SGEN: An attempt was made to load an assembly with an incorrect format

I am working on a conversion of tfs 2013 build definition, we were initially using tfs 2008.I have a new server with TFS2013 installed and working on Build definition for 2013 xaml (workflow) customization is completed. However i am facing an error when my TFS build in release mode for Any Cpu configuration, but its fine when i use debug mode. I have tried looking many articles and unable to find any solution kindly help me here. This is fine in my local machine but happens only in the server.
Project and details
1) project is .net framework 4.0
2)Default configuration is "Any Cpu"
3)TFS 2013 server is 64 bit, windows server 2008 r2
Build Definition
Configuration : Any CPU|Release
MsBuildPlatform : x86
Error:
SGEN: An attempt was made to load an assembly with an incorrect format: C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll.
Warning:
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (990): The reference assemblies for framework ".NETFramework,Version=v4.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
I have installed windos 8 SDK (Tools only)
and Windows framework 4 x64 as x86 version is failing
The folder C:\Program Files\Microsoft SDKs\Windows has v7.0 folder
C:\Program Files (x86)\Microsoft SDKs\Windows has v8.1A folder
where as my local machine has many versions inside the windows folder in above path
List of related articles which i have checked,but couldn't find a solution
http://seravy.wordpress.com/2012/10/25/installing-net-4-5-and-not-windows-sdk-8/
http://blogs.msdn.com/b/windowssdk/archive/2009/09/16/windows-7-sdk-setup-common-installation-issues-and-fixes.aspx
Running MSBuild fails to read SDKToolsPath
http://dukelupus.wordpress.com/2008/02/05/task-failed-because-sgenexe-was-not-found-solution/
How do I fix the Visual Studio compile error, "mismatch between processor architecture"?
TFS 2010 creating .Net 4.0 XmlSerializers DLL for .Net 3.5 Application
So what should i do to fix this error ?
You need to install the targeting packs (aka SDK, aka Developer pack) for the .NET Framework version you are targeting. You can download them all from http://blogs.msdn.com/b/dotnet/p/dotnet_sdks.aspx
Specifically for your question and targeting .NET Framework 4.0, you want Windows SDK for Windows 7 and .NET Framework 4 Sounds like you grabbed the Windows 8 SDK, which is not what you want for targeting .NET Framework 4.0.
This is not a very good answer (but in case someone comes across it like me), and does not provide insight into why it is occurring. But turning off "Generate the serialization assembly" on the offending project does allow for the build to work in my case.
Start up times will be slower, as serialization will occur at runtime instead now.
You simply need to see what framework you are using and then what debug mode you are using.
In my case i was using framework 4.0 and Build mode target framework "any cpu" but after searching around i found that i need to upgrade my .Net framework from 4.0 to 4.5 and i have to build my solution from "any cpu" to x86 framework because i had Windows 7 SPI with x86 architecture.
Here are some images what i have done to solve this error.
I encountered this error (albeit for a newer .NET framework version, v4.5.1, not v4.0 as in the original question) when trying to build my application on a build server.
The combination of the following two conditions was responsible for the error:
In Visual Studio, on the Project Properties page, on the Application tab, the "Target framework" was set to ".NET Framework 4.5.1";
On the build server, in folder C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework, a folder named v4.5.1 was not present. (Other folders with version numbers, including v3.5, v4.0, and v4.5, were present.)
This missing folder was the cause of the "The reference assemblies for framework ... were not found" warning, which in turn lead to the "assembly with an incorrect format" error.
The fix was to install Windows Software Development Kit (SDK) for Windows 8.1 on the build server. In the install wizard, in the "Select the features you want to install" step, I unchecked all boxes except for the one for ".NET framework 4.5.1 Software Development Kit".
Running that install caused the missing v4.5.1 folder in the Reference Assemblies\Microsoft\Framework.NETFramework folder to be created, and the build to run successfully.
I am reluctant to answer because you say you have already done this, but every time I have struggled with the error message you quote, it has been the MsBuildPlatform setting. It absolutely has to be set to "X86". Are you sure the setting is being set..?

Whats going on with MVC5+ Assemblies?

I was planning to upgrade my project from MVC 4 to MVC5. I followed this article: http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2. I did all the steps successfully, but got errors that the 5.0 dll could not be loaded.
The article, however, has no mention of where to get the DLLs. So I started looking for the DLLs everywhere, my file system, online, Google, etc.
Then I created my own MVC5 test project and noticed that the MVC 5.1 DLLs got added from nuget.
So, is Microsoft only distributing MVC dlls from nuget?
Also, I can find the MVC4 dlls from the file system and MVC5.1 dlls from the nuget package, where are the MVC5.0 dlls?
If you want a specific version from NuGet, open the Package Manager Console and type:
Install-Package Microsoft.AspNet.Mvc -Version 5.0.1
Which is the latest in the 5.0 series.

Resources