c# and .Net Target on Target Systems

reredok

New member
Joined
Aug 20, 2022
Messages
2
Programming Experience
1-3
Hello all,

I have a little understanding problem with my small C# projects and .Net.

If I created a project and set as target .Net 4.8, then on a target machine to which I copy all the files \bin\debug\* must be installed on the .Net 4.8 version?

The same goes for the DLL references for included NuGet packages?

I have several cases on target systems without .Net 4.8 and the C# exe still works and one case with .Net 4.8 installed where the application crashes because it can't load the NuGet DLL.
Further cases where I install the .Net 4.8 runtime the application still does not run.

Quite confusing. Do you have any explanation?

Thanks a lot
reredok
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
4,643
Location
Sydney, Australia
Programming Experience
10+
Firstly, don't copy anything from the Debug folder. the name should be a clue: that's for debugging. When you want to deploy your app, create a Release build and deploy from the Release folder.

As for the .NET Framework, are you sure it wasn't installed? It's been a standard part of Windows for quite a while now, so it should be installed by default and (I think) cannot be installed from a separate download.

As for DLLs, of course they need to be present. If your app uses a type declared in a library and that library isn't present when your app runs then it can't use that type. Unless you're using a component that will be installed on the system separately, you should set Copy Local to true for a reference. That DLL will then be copied to the output folder when you build your EXE and you deploy them together.
 

reredok

New member
Joined
Aug 20, 2022
Messages
2
Programming Experience
1-3
Firstly, don't copy anything from the Debug folder. the name should be a clue: that's for debugging. When you want to deploy your app, create a Release build and deploy from the Release folder.

As for the .NET Framework, are you sure it wasn't installed? It's been a standard part of Windows for quite a while now, so it should be installed by default and (I think) cannot be installed from a separate download.

As for DLLs, of course they need to be present. If your app uses a type declared in a library and that library isn't present when your app runs then it can't use that type. Unless you're using a component that will be installed on the system separately, you should set Copy Local to true for a reference. That DLL will then be copied to the output folder when you build your EXE and you deploy them together.

Thanks for the answer.

When creating the project I encounter the problem that it wants to install with the Setup.exe .Net 4.8 but this is already installed on the target system.

Publish project - from CD-ROM or DVD - c:\deploy\myapp.

I copy this directory to the target system and run the setup.exe. The setup always wants to download the .Net 4.8 version although it is already installed.
 
Top Bottom