I hope this is no duplicate but I couldn't find any related topic. Every developer knows the problem. I create my app, deploy it and on some other machine it does not run because some dependency is missing. Often those dependecies are part of the workloads installed along with Visual Studio or some SDKs.
My question now is if there is a way to test my app on my dev machine like it had not installed SDKs and VS? Basically I want the app to only consider dependencies I explicitely specified through project references, nuget packages or locally copied files. Or in short: every dependency should be part of the app's deployment target folder.
Of course some really basic OS-dependent stuff needs to be used as well but I don't want the app to use stuff like OpenAL, GLFW, Windows SDK or similiar things just because I have installed it on my machine beforehand.
I hope you can understand what I mean. So I basically need some sandbox. I know there are things like VMs, docker, etc but I would like to use this as I run my app from Visual Studio. So if I hit F5 I want the app to ignore globally installed stuff at all.
I work with VS 2022. Thanks for advice.
CodePudding user response:
As a general rule of thumb, you can reference Nuget packages instead of assemblies in the GAC. This way, they will be copied to your application's bin folder.
You can also use .NET Application Publishing to create a deployable folder with your application. If you're targeting .NET Core, and the target machine may not have .NET Core installed or you don't know what version it will have, you can create a self contained release which will include the .NET Core binaries in the release.
See https://docs.microsoft.com/en-us/dotnet/core/deploying/
CodePudding user response:
You could use a continuous integration system in order to build (from scratch), publish and test on a fixed known build agent configuration. I used Teamcity.
You could use a Virtual Machine or a docker image as agent PC.
Moreover you can configure more agents with different possible configurations.