1

So here goes, I'm in the process of upgrading the framework of multiple Projects within a large web applications. The process is pretty straightforward I"m going from 4.5 to 4.7 and I'm upgrading a few of the Nuget packages. I'm going to provide a word document with screenshots, however is there something "automatic" within Visual Studio that can generate a report of the current framework and list of nuget packages.

My problem is I have one project that has 20 or so Nuget packages and I have to do several screenshots to get them all. I don't want to do this again to show before/after.

John
  • 193
  • 1
  • 1
  • 11
  • Look into your [packages.config](https://stackoverflow.com/q/24556580/11683)? – GSerg Aug 19 '19 at 18:34
  • Thanks, How about is there a way to show the .NET framework of the SPECIFIC application on a web server. I understand how to find the .NET framework installed by going thru the registry. – John Aug 19 '19 at 18:45
  • you may use corflags to determine which version of .net your website was compiled over: https://serverfault.com/a/322767 . Check additional links to supported and required runtime elements in that post. – fenixil Aug 20 '19 at 04:04
  • Hi, any update for this issue? Please check if my answer helps, if the issue persists, feel free to let me know:) – LoLance Aug 22 '19 at 01:50

2 Answers2

0

You may use DTE to get any details about projects inside of VisualStudio.

TargetVersion

Open Package Manager Console (Tools -> Nuget Package Manager) and execute below command to select target version of the projects inside of your solution:

$dte.Solution | Select-Object -Property ProjectName, {$_.Properties["TargetFrameworkMoniker"].Value }

Nuget package version

Nuget package could be added to packages.json or to .csproj file as package reference. In both cases you can use DTE to get list of packages:

# below is an example for the first project
$project = $dte.Solution | select -first 1 
$project.Object.PackageReferences

I wasn't able to get nuget version from that object though. So I assume you just get keys and then use $project.Object.References to get required details (version/path...). If you know list of packages, then you can skip step 1.

Good old XML

Another option is to parse .csproj and package.config files and extract required details from there, here is powershell example.

fenixil
  • 2,106
  • 7
  • 13
0

however is there something "automatic" within Visual Studio that can generate a report of the current framework and list of nuget packages.

I'm afraid not, as I know VS doesn't have this feature to generate a report. You can easily see the project's framework by right-clicking the project=>project properties in solution explorer.

And as for the list of nuget packages, you can find the content you want in packages.config file.

I have one project that has 20 or so Nuget packages and I have to do several screenshots to get them all. I don't want to do this again to show before/after.

The packages.config file have listed all nuget packages the project references though it's not a report.

And it seems you're upgrading your project to higher target framework, you can use the Nuget Package Manager UI to update them or Package Manager Console to update them.

Update packages by UI:

enter image description here

Update package by command in VS:

We can use Package Manager Console in VS, and you can use the command like Update-Package -Project YourProjectName. More details see this similar issue.

How about is there a way to show the .NET framework of the SPECIFIC application on a web server.

In my opinion you're trying to find a way to get the target framework of an assembly. Since the build output of a web-app is a xx.dll, actually you're trying to know what the target framework of the assembly. There're many tools and workarounds for this requirement, you can check this thread.

For this topic, I suggest you can either use Sean B's or Asain's suggestion:

  1. Use notepad to open the assembly and find the last framework keyword:

enter image description here

  1. Or use find "Framework" WebApp.dll in cmd.exe(It should be Framework instead of framework):

enter image description here

Hope all above helps and if I misunderstand anything, feel free to let me know :)

LoLance
  • 25,666
  • 1
  • 39
  • 73