Is it possible to add Crystal Reports into .NET Core app targetting 4.6 - c#

I am currently trying to develop a small web application for a business. I started development using .NET Core 1.1 version. And when I tried to study how to add Crystal Reports into the project, it is said that they are not supporting it yet.
Is it possible to add Crystal Reports if I change my target framework to 4.6 in the .NET Core app? Or do I have to start a new web application targeting .NET Framework project 4.6.2 from scratch again?

This should absolutely work. When targeting the full framework like 4.6 with Asp.Net Core you have access to any dlls that are based on 4.6 that you create project references to.
If the makers of Crystal Reports said they are not supporting it yet, perhaps they mean they are not supporting it via direct reference from a project json file but even that seems suspect. But now with VS 2017 the project json is no longer used and .Net Core projects use a regular cs proj file fairly similar to what non .Net Core projects have always uses. So again, use VS2017 you should absolutely be able to reference Crystal Reports Dlls directly and you should be able to reference a full framework class library that references a Crystal Reports DLL.
Another possibility is that maybe their designer support tooling needs updated in some way for .Net Core Projects. But even if that's the case, running an existing report should work.

Related

Why does a dotnet Core App with a reference to a classic .Net project works and compiles [duplicate]

I'd really like to start using .NET Core and slowly migrate applications and libraries to it. However, I can't realistically upgrade my entire code base to use .NET Core and then go through the process of testing and deploying a plethora of applications in production.
As an example, if I create a new .NET Core application and try to reference one of my .NET Framework projects I get the following:
The following projects are not supported as references: -
Foobar.NetFramework has target frameworks that are incompatible with
targets in current project Foobar.NetCore.
Foobar.NetCore: .NETCoreApp,Version=v1.0
Foobar.NetFramework: .NETFramework,Version=v4.5
Is it possible to create a new .NET Core application and reference my existing .NET Framework libraries? If so, what's the process for doing that? I've spent hours going through Microsoft's documentation and searching their issues on GitHub, but I can't find anything official on how to achieve this or what their long-term vision is for this process.
Old question, but with the release of .NetStandard 2.0 and .netcore 2.0 and vs2017.3, the game has changed.
You can use the Full .NET Framework (TFM) with .NetCore 2.0, but how?
In Visual Studio 2017.3, you can reference the Full .NET Framework (any version) directly from within a .NetCore2 project.
You can build the .NetStandard2 class library and reference your TFM. Then reference your .NetStandard2 library from your .NetCore2 project.
For example, referencing json.net net45 from .NetStandard2.
Browse to the folder and select version net45 (not netstandard1.3)
See the dependency in the image below, no yellow warning as you see.
Even if a Nuget library is not ready to be ported to .Netstandard 2, you can use any API in the library that is compliant to net461.
Quoting for the .NET Core 2/Standard 2.0 announcement with links:
.NET Core 2.0 is able to freely reference libraries that have been built for .NET Framework up to version 4.6.1
However, some libraries may fail at run time if they try to use API methods that aren't available on .NET Core
Reference: .NET Core App target .NET framework 4.5.2 on Linux
A need to use third-party .NET libraries or NuGet packages not available for .NET Core
So only in cases where the libraries or NuGet packages use technologies that aren't available in .NET Standard/.NET Core, you need to use the .NET Framework.
Reference: Choosing between .NET Core and .NET Framework for server apps
You can now reference .NET Framework libraries from .NET Standard libraries using Visual Studio 2017 15.3. This feature helps you migrate .NET Framework code to .NET Standard or .NET Core over time (start with binaries and then move to source). It is also useful in the case that the source code is no longer accessible or is lost for a .NET Framework library, enabling it to be still be used in new scenarios.
Reference: Announcing .NET Core 2.0
Yes, we are currently attempting the same thing. The trick is to make sure that you are supporting the same .NET frameworks. Inside your project.json file, make sure the framework matches the framework of the project you wish to include. For example:
"frameworks": {
"net46": { --This line here <<<<
"dependencies": {
"DomainModel": {
"target": "project"
},
"Models": {
"target": "project"
}
}
}
},
FYI: You might need to change the framework of your .NET Core or your older projects to achieve this. .NET Core can be changed just by editing the project.json file as seen above. You can so the same in .NET projects by right clicking the project and opening properties. Change the framework level there.
Once you have matched the two project frameworks then you should be able to include them. Good Luck!
We delayed migrations as long as could as it seemed daunting as first. But we got an insistent client who wanted to migrate ASAP.
So we migrated their Fintech Web App developed on .NET Framework 4.8 Web Forms to .NET 6 Razor Page. Our team scoured though hundreds of online resources & spoke to Microsoft Tech Support before we started the project. Hope the high-level walkthrough of our journey help you plan your migrations.
Our .NET Framework Website consisted of 1 .NET Web Forms project and 12 Class Libraries.
Here is how we did it.
Refactored the .NET Framework 4.8 Web Forms code
We ensured that the Web Forms code behind did not have a single line of service or business logic code. When we did find some business logic code in the web forms code behind, we refactored it, by moving it to the class libraries.
Created new .NET Standard projects
We created a new .Standard 2.0 Class library project for every .NET Framework 4.8 Class Library. If the original project was called "FintechProjectName.StockMarketClient", we named the .NET standard project "FintechProjectName.StockMarketClient.Standard".
Copied all files from .NET framework to .NET standard
We copied all the class files from .NET framework to .NET standard projects. We then removed all the .NET framework class libraries from the solution and added references to the new class libraries. All projects compiled on the 1st try itself and all our test cases too passed with minor changes.
Create new .NET 6 Web App Project
We created a new .NET 6 Web App Project. We had to entirely redo the front-end as there is no direct path for migrating Web Forms to Razor Pages. This was the only project which took us about 1 month to migrate.
Reference .NET standard class libraries in the new .NET 6 website
We copied all the .NET Standard libraries to this new solution containing the Razor Pages web site. Added the references and got it to work.
Move from .NET Standard to .NET 6 class libraries
Once the new website was up and running, with all test cases passed, we did the last step in the process which was the simplest. Created .NET 6 class library projects for each of the .NET standard libraries and named the projects appropriately. Copied all class files from .NET standard projects to their corresponding .NET 6 projects. Then we removed the .NET Standard libraries and added references to the new class libraries.
Overall project timelines were about a month and a half, most of it spend on Razor Pages implementation using the same html design.
Note:
If you are using any 3rd party library which does not have a .NET standard or .NET 5 version, then you are out of luck. You will need to find a replacement nuget package and recode your application to use this new library.
In my case with .net6 referencing framework 4.8 library ( both winforms), the trick seems to be to add the reference to the framework dll as a shared reference.

Deploy .NET winforms application packaged with .Net Framework

I have a Winforms application developed in c# targetting .Net Framework 4.0. I created a setup for the application and packaged the .Net Framework 4.0 within the setup. During installation, the setup installs the .Net Framework 4.0 (if not installed already), and the application works fine.
I know it's not possible to run .Net application without .Net Framework. Is there some way I can package the CLR, JIT, and all required dll's with my application so that I won't need to install the entire .Net Framework 4.0 on the target machine?
Can i create my own installer for .Net Framework 4.0? Installer which insalls only the libraries which are required for my application, thus eliminating the need to install entire .Net Framework?
I have looked into ngen, Turbo Studio etc. to containerize the application but that does not suit for my purpose. Any help will be highly appreciated.
The .NET Framework was not designed to be deployed partially. I don't think this is possible - even if you will get that to work, it won't be supported officially. You might even see that your app is running but it might crash at any time later as soon as an assembly gets referenced (lazy by reflection, for example) you have no direct reference to.
Having only those parts of the framework deployed which are directly or indirectly referenced by your app is one of the main ideas of .NET Core - but you won't be able to do full-featured UIs with it by now.

Visual Studio - Cannot start ASP.NET Core project

Last few months I create console applications with .NET framework and C#.
Now I want to create ASP.NET Core MVC projects, but I cannot choose any .NET Core template.
If I click "Console App (.NET Core)" or "ASP.NET Core Web Application" or any other .NET Core template, I can see this error message:
So, the problem occurs if I choose "Core", other templates work fine.
I have already tried to find a solution on Google.
What could be the problem? I reinstalled VS few times but did not help.
.NET Core does not support COM. COM is a Windows-only thing, and everything in Core is cross-platform. You must run on the full framework if you need to utilize a COM library.
That said, Microsoft has recently release a preview NuGet with some Windows compatibility APIs. This may allow you to utilize COM; I haven't tried it. However, the stated purpose of the NuGet is to make it easier to migrate existing .NET Framework applications to .NET Standard/.NET Core, so it's not considered something you would continue to utilize long-term. Rather, the idea is that you would actively work to migrate code that is not compatible to equivalent .NET Standard/.NET Core APIs, and then eventually remove the package entirely. As a result, it's probably not a good idea to go this route, even if it does enable you to use the COM library, simply because you're not likely to be able to stop at some point in the future.
Long and short, just run on the full framework.

Is there a way to add and start a .Net Core 2.0 REST server inside a .Net Framework 4.5.2 (or .Net Framework 4.6.1 or .Net Standard 2.0) application?

Issue
Hi,
I am currently working on implementing a RESTful API in C# using ASP.net Core 2.0 in Visual Studio 2017 (running only via Kestrel, therefore no IIS).
Everything works pretty well, no issues there. The thing is that I now need to integrate and start this REST Server in another project (The REST server being only one of many functionalities that need to be executed at the same time, using a "bootstrap"). My issue here is that the latter project targets .Net Framework 4.5.2 whereas the REST server targets .Net Core 2.0. Thus, when I add the REST server to the references of my bootstrap application, I encounter a couple of errors saying that some of the Nuget packages target the wrong framework.
Solutions I tried
I searched over Google but most of the issues I found were people trying to do the other way round, i.e. adding a .Net Framework-targeted project in a .Net Core application.
The way I understood this .Net implementation support table, is that a .Net standard 2.0 project can support a .Net Core 2.0 project (I am probably wrong).
I tried a couple of things to make it work (which, spoiler alert, obviously and unfortunately did not work as I wouldn't be asking your help) :
Made the boostrap application target .Net Standard 2.0
Made the boostrap application target .Net Framework 4.6.1
Made the REST server application target .Net Standard 2.0 (which it of course didn't work, but I was kind of desperate..)
I made these target change by modifying the .csproj files.
I don't have the exact error codes because I reverted my changes a while back but they all were about projects not targeting the same framework.
So, in a tl;dr manner, what I am asking is :
Is there a way to add a .net Core 2.0 REST server inside a .Net Framework 4.5.2 (or 4.6.1 and higher/ or .Net Standard 2.0) project to start the server inside the application ?
Apologies for any english mistake as it is not my native language.
Don't hesitate to ask more info on my problem if I wasn't clear enough and thanks for the help !

Are .NET Core projects referencing PCLs cross-platform?

I have a .NET Core (ASP.NET Core) project created using Visual Studio 2017 RC (MSBuild).
I also have an old F# project library (traditional .NET Framework Library) that compiles to a dll file. I want to use it in said ASP.NET Core project.
To do that, I added a project reference in the ASP.NET Core project, opened the namespace, and made a few function calls in my controllers; it works perfectly when running the ASP.NET Core server using ISS from VS.
My question is, will this arrangement work if I want to deploy to linux (Ubuntu)? Or does using external PCLs/dlls from .NET Core instantly make it windows-only?
Note that I didn't have to add .NET Framework as a target framework in my csproj (it's MSBuild Core), it just worked.
Since your F# project targets the .NET Framework it will not run cross platform. If you modify your F# project to target the .NET Standard library it will. Here is a video by Immo Landwerth explaining how the .NET Standard Library works.
You should be able to just to reference the .NET standard library and not have to change anything. However the current version, which is 1.6, is missing a lot of API's from .NET Framework. This is fixed in 2.0. Infact since your using .NET Core 1.1 I think you are already using 2.0, but I'm not certain. Here is another video by Immo explaining how it should work.
That being said, I'm not sure what the F# support is like with .NET Standard.

Categories