We developped 2 differents applications with visual studio 2013 :
The first for the front-end in C# .net mvc5
The second for a web service in C# .net WebApi 2
Both applications use newtonsoft.json nuget but with different versions (6.0.8 for front and 8.0.2 for web api).
We use Local IIS to test and debug.
In IIS we create 2 websites, and 2 separate application pool.
If i compile the the web service after front end, everything is fine.
If i compile the front end after the web service, the web service crash with the 6.0.8 version of newtonsoft.json ! Why ?
The application pools shared some dlls ?
I found some articles with the "Specific version" option of the reference in the projects. With the "specific version" at true, both version can run in parallel. But i don't want to do that.
I can also update the nuget to have the same version in both projects but it is a workaround, the problem could still there with another dlls.
I need to understand why with 2 applications pool share dlls (with différents versions)...
So do you have an idea :-) ?
Thanks
Whiletrue
Following from your comment - the reason is quite simple now. your webapi and mvc project both depend on classlib which depends on newtonsoft specific version. so when you build any of webapi or mvc project, classlib's dependencies are also added to webapi or mvc project. you can either break the dependency somehow or specify versions in the web config + project file explicitly and have both versions in your Bin folder.
Related
I have 2 projects, an ASP MVC project and an ASP Web API project using .NET Framework 4.7.2
From a coding perspective both of these project types are very similar.
Yet the MVC project publishes to <100MB and the API project to 500MB+, despite the MVC project containing numerous JS libraries and other content.
This seems to be down to a folder the Web API project includes called "runtimes". Is this folder necessary, can it be optionalised, are there some optimisation options I can set?
This is the framework which is published because of the settings in your publish profile.
Publishing your app as self-contained produces an application that includes the .NET runtime and libraries, and your application and its dependencies. Users of the application can run it on a machine that doesn't have the .NET runtime installed.
Publishing your app as framework-dependent produces an application that includes only your application itself and its dependencies. Users of the application have to separately install the .NET runtime.
https://learn.microsoft.com/en-us/dotnet/core/deploying/
Microsoft says it's platform neutral these days, so I'm trying to build on Mac and Linux only with VS Code and deploy to Azure. Why? It's mainly to prove that I can.
Our project has several parts which include a couple of different websites, a Web API, er API and a few other bits. On my Mac I've built a .Net Core Class Library with a load of objects in. Command line, dotnet build, DLL out, no problem.
I want to put that DLL on the Linux machine where the MVC website is being built - the objects forming the models part of that site hopefully. I cannot figure out how to get the website project to reference my DLL and use the objects.
I had assumed I copy it to the other machine, place it in the bin folder of the site being developed and reference it in the Dependencies section of the site's project.json. Nope. I saw a few articles that said .Net Core only works with NuGet and it had to be a package. Is that really true?
I've found and read (if not entirely understood) everything you could imagine on sharing between .net core and .net framework. This is a core-only project so not applicable. Frankly I'm lost, and something called .Net Standard has just rolled into my field of vision.
So instead of copying the DLL, use dotnet pack to build a nuget package on your Mac, and copy that to your Linux machine instead. Put it in a directory that you configure as a local nuget repository (no server or anything required) and you're away.
I agree it's not as straightforward as a reference to a DLL, but it's not too bad. Note that you'll need to version the package appropriately, so that the tool system can detect when it's changed.
I have created an ASP.NET MVC 5 project with Entity Framework and a MySQL database. In Debug-mode everything works perfectly, but now I would like to publish it to my IIS-Server.
The first project in my Solution is AspNet.Identity.MySQL which
allows me to use Entity Framework in combination with Identity 2.0
and MySQL. It is from codeplex. https://aspnet.codeplex.com/SourceControl/latest#Samples/Identity/AspNet.Identity.MySQL/
The second project is my ASP.NET MVC application.
Publishing the second project by itself is no problem. I just don´t know how to publish the first project (AspNet.Identity.MySQL).
Long story short,
I have this and don´t know how to deploy/publish it via File-System:
IdentityWeb is the ASP.NET MVC Appliaction.
Thanks for your help,
Beardy Bear
The first project AspNet.Identity.MySql is a class library, so it's output is a DLL only. When you build the solution, a DLL is output into the bin folder. If project IdentityWeb has a reference to the other one, the DLL for it will appear in the bin for that project too.
As long as when you publish the IdentityWeb project, it has the DLL AspNet.Identity.MySQL.dll in the bin, then you should be able to deploy your ASP.NET MVC application to IIS.
We have a solution structure like:
Project 1 (Sandbox)
Project 2 (Farm)
Project 3 (Common Library, dll)
Both Project 1 and Project 2 are using the Project 3 output dll for some functionality.
Everything was working fine on SharePoint 2010 with .NET 3.5 (every project).
Now we have to migrate to SharePoint 2013 means we have to compile now with .NET 4.5 and its new Security Level (no more CAS etc.)
The problem is that the Sandboxed Solution can not activate its feature because of errors like:
"Namespace.Method" is security transparent, but is a member of a security critical type.
Is it not possible to use a common library in sandboxed solution anymore?
I tried to use the SecuritySafeCritical / SecurityCritical / AllowPartiallyTrust attributes and features but no combination could resolve the problem.
(No more CAS in 4.5)
In the assemplyInfo.cs file add the line:
[assembly: AllowPartiallyTrustedCallers]
Deploy the Sandbox solution and then the Farm solution. Since both are referring your dll, the farm will successfully update the dll.
Can you install ASP.NET MVC3 and MVC2 side by side?
I want to install MVC3 and try it out on a smaller project. BUT I want to retain our current large project on MVC2 for a little while.
If I install MVC3, will my existing project be automatically upgraded or do I have the option to keep it on MVC2?
MVC 3 and 2 can exist side-by-side. The project file will not / does not have to be upgraded.
For more details, see http://www.asp.net/learn/whitepapers/mvc3-release-notes
Question title says it all: Can you install ASP.NET MVC3 and MVC2 side by side?
You can perfectly fine have ASP.NET MVC 2 and 3 running side by side on the same machine. In VS2010 you have the possibility of choosing which version you want when creating new projects and on the production server you can have MVC 2 and 3 applications running side by side without any problems. Just don't forget that MVC 3 implies .NET 4.0 whereas MVC can run on both .NET 3.5 and .NET 4.0 application pools.
Yes, I have MVC2 and MVC3 installed on my development machines. When you start new projects you are prompted for both MVC versions to choose from.
Yes, but:
I had a problem with NUnit because some of the classes are defined in both versions of the System.Web.Mvc dlls. The applications run fine, but an NUnit looses its mind - it blows up with a message Cannot cast SelectedList to SelectedList.
Edit
I am running NUnit 2.5.5. Whats happening is that when the application is built it is using the version 3.0.0.0 of the dll, but when it is run under NUnit by the time it loads the app dll, the 2.0.0.0 version of the dll is already loaded. Both of them have the SelectedList class defined in them and that causes the NUnit to loose its mind