2

I'm working on a large ASP.NET solution. Inside the solution are multiple ASP.NET projects. Inside each project, is a web.config file. A few weeks ago, I tried to upgrade all of the projects from .NET 4.5 to .NET 4.7. I did this by right clicking each project in solution explorer, going to properties, and setting the .NET version on the screen that pops up. Using this method, I was able to easily change all of the projects in the solution to 4.7 (or so I thought). A few days later, I looked at the web.config file for one of the projects and saw this (incomplete file):

  <system.web>
<httpModules/>
<httpRuntime enableVersionHeader="false" targetFramework="4.5"/>
<sessionState REMOVED>
  <providers>REMOVED
  </providers>
</sessionState>
<compilation debug="true" targetFramework="4.7">

From what I can tell, the project I'm running uses 4.7, and ignores the 4.5 targetFramework code. I can access 4.7 API calls, and rolling the code back to 4.5 using the method shown above disables the 4.7 API calls. Still, I can't help but worry.

To make things more complex, I have text like this in my packages.config file:

<package id="EntityFramework" version="6.1.3" targetFramework="net45" />

With all that being said, is my project running in 4.7, 4.5, or some kind of bizarre mix?

Is my code safe, or is it going to self destruct in some kind of bizarre edge case?

Dan Gifford
  • 886
  • 1
  • 9
  • 33
  • 1
    related maybe an answer: https://stackoverflow.com/questions/40170567/what-do-the-targetframework-settings-mean-in-web-config-in-asp-net-mvc – SCFi May 16 '18 at 15:37
  • @SCFi close! It doesn't explain why I can run .net 4.7 code in my projects. The answers weren't upvoted much on that thread. I consider it to be incomplete. Hopefully we can get to the bottom of things on this question. – Dan Gifford May 16 '18 at 16:15

0 Answers0