In my application their is a requirement of .net framework 4.5 to run it properly on other machine.
How it is possible that when my application is being install then .net framework is installed automatically?
You can set in dependency by adding the reference of .Net 4.0 Framework.
Did you check it by making .dll of third party applcation and referenced to you active application?
Related
I am developing a Web Application with ASPNET Core 2.0 on Visual Studio Code on Linux. But the host I'm trying to deploy the application is a Windows Server and the only target available option is .Net Framework 4.6.
So, when I try to run dotnet publish -o /folder -f net461 it shows me
this error.
Is it possible to develop an aspnet core application on linux and deploy it on windows using .Net Framework?
The following is the text of the error:
/usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1122,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.1" 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. [/home/maransatto/Projects/FATEC/EraDoConhecimento/web/BDAg.csproj]
There are 2 scenarios: ASP.Net Core with .Net framework and ASP.Net Core with .Net Core. You can't develop asp.net core with .net framework on linux, so probably your application's target is "netcoreapp2.0" (suposed you downloaded the latest version). It's ok you deploy your app on windows server just using .net core runtime 2.0.
your command should be
dotnet publish -c Release -f netcoreapp2.0
You can deploy Framework-dependent or self-contained version. See (https://learn.microsoft.com/en-us/dotnet/core/deploying/index).
You also need Asp.Net Core Module on windows with IIS Integration.
https://learn.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x
When publishing self-contained you don't need .net core to be installed on the server.
I have a test project int Core 2 console (Core2ConsoleTest).
It make a reference to .NET Framework 4.6.1 Project (NetFrameworkTest).
NetFrameworkTest project references the standard System.Printer.dll.
Download Core2ConsoleTest project here
When I call to any System.Printer function I have the error: Could not load file or assembly 'System.Printing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. El sistema no puede encontrar el archivo especificado.
I tested with other standard libraries like System.Windows.Forms.dll and the same error if the Core project references a Nuget Package that uses standard libraries.
Note: The same error with ASP.Net Core 2
Thanks for your help!
This is not going to work on .NET Core.
.NET Core 2.0 has a compatibility layer that allows loading and using .NET Framework libraries but this only works as long as this library only uses types and methods that are also available on .NET Core.
Since System.Printing is not part of .NET Core, this library will fail to access it with the exception you posted.
Only .NET Framework applications can use this API (e.g. an ASP.NET Core on .NET Framework application).
I really have the problem with ASP.Net Core Framework Project. I'm unable to create a new Project with Core 2.0 and reference a Framework library that references System.Printing.dll or other libraries.
But #mairaw gave me another way: On a project that works in Core 1.1, updating the libraries Nuget to 2.0, works correctly.
So it looks like a Visual Studio 2017 problem or Core templates.
My concern is to remove this functionality, because it allows to adopt the Core technology in a staggered way with a high code reuse.
Edit: Added sample projects
CoreTest.zip -> A ASP.Net Core Framework Project created referencing Core 1.1 and .NET Framework 4.6.1 in the past, then upgraded to Core 2.0 using Nuget: WORKS!
Core2Framework.zip -> A similar project (ASP.Net Core Framework Project created referencing Core 2.0) created with Visual Studio 2017 15.3.4: ERROR when calling System.Prinig.dll from the .NET Framework 4.6.1 Project.
I am using some dll's from the crm 2011 sdk in a .NET 3.5 web part.The target is for SharePoint 2010 online. When I try to build it gives me the following error:
The primary reference "microsoft.xrm.client" could not be resolved because it was built against the ".NETFramework,Version=v4.0" framework.
This is a higher version than the currently targeted framework ".NETFramework,Version=v3.5". VisualWebPartProjectWebServiceTest.
I cannot upgrade my web part to .NET 4.0 because SharePoint 2010 is not supporting .NET 4.0. Is there some other solution to reference .NET 4.0 dlls in a .NET 3.5 sharepoint webpart?
I will say NO, you can't use .Net framework 4.0 dll in 3.5 but Yes in the other way around. There are a few workarounds to achieve this, but in a little different way. Check these following SO posts for further reference:
Can you use a .NET 4.0 dll in a 3.5 project?
How Can i use .NET 4.0 code in C# project which is built using .NET framework 3.5?
Making a call to a .NET 4 library from 3.5
Uptil now, we've been using C# to install GAC DLL's to the GAC without any issues
System.EnterpriseServices.Internal.Publish p =
new System.EnterpriseServices.Internal.Publish();
p.GacInstall(filePath);
However, we tried using the same code to install a .NET 4.0 GAC DLL. It does not give any error and says that the GAC is installed.
However, when I look in C:\WINDOWS\Microsoft.NET\assembly folder I do not see the GAC being installed. Also, when I look up the event viewer on the Server it shows me a warning
"Source: COM+ SOAP Services Installation in the global assembly failed: <GACDLL_PATH>
Is there any way I can install a .NET 4.0 GAC DLL into the GAC programtically using C#?
I was able to resolve this issue
I rebuilt my C# project with the target framework 4.0.
Previously I was trying to install .NET 4 GAC DLL with a c# project that was built with the target framework 3.5...
After the project was rebuilt with .NET 4.0 framework I was able to install .NET 4 gac dll. Also, this is backward compatible i.e. you can install GAC DLL's created with previous versions of the .NET framework.
NerdDinner.csproj won't load in vs2008 sp1 with .net 3.5 sp1. Am I not up-to-date on these tools or something? It complains this project type not supported on this installation.
Do you have the ASP.NET MVC Framework installed? If not, you need it. NerdDinner is an example of an MVC Framework project, and you won't be able to open it or run it without the ASP.NET MVC Framework installed.
You can find the appropriate installation information at http://www.asp.net or more specifically http://www.asp.net/mvc
In my I had to change the value of the "ProjectTypeGuids" in the project file. I copied them from another MVC project that I had created with my version of VS 2008.
This is the post that gave me the answer:
http://www.stuffthatjustworks.com/How+To+Fix+Xcsproj+Cannot+Be+Opened+The+Project+Type+Is+Not+Supported+By+This+Installation.aspx
In my case...it was the wrong version of the framework.
I just copied the from another asp.net mvc project I had made. (then you probably have to fix up the references, which is trivial with resharper :-) )