'Purpose of the .deps.json file in .NET and can I avoid it?
Recently we've started migrating to .NET 5/6 to get the most out of new C# versions amongst other reasons. We make WPF apps using MSI installers to distribute.
Looking at one of our projects, I noticed some new files that we may need to add into our installers. In particular, I noticed the addition of a .deps.json file in the output. My question is: is this absolutely necessary for any .NET exe application to run?
The way I see it, the end user will only have the runtime, and no Nuget to install any missing libraries. All the required dlls, either from referenced projects or packages, are included in the output folder, as is expected in .NET Framework, so surely we don't need the deps.json file just to tell .NET runtime where the dlls are?
Is there any way to avoid needing a .deps.json file? Are there any other changes we should look out for when authoring our MSIs when using .NET 5/6?
Thanks for any help.
Solution 1:[1]
interestingly your code works just fine for me on fedora g++ compiler. it might be my compiler allocates 8Bytes to integer and yours might be allocating 4Bytes to integer so please try this and let me know.
#include <iostream>
struct node {
long val;
node* left;
node* right;
};
node* createNewNode(long x)
{
node* nn = new node;
nn->val = x;
nn->left = nullptr;
nn->right = nullptr;
return nn;
}
void bstInsert(node* &root, long x)
{
if(root == nullptr) {
root = createNewNode( x);
return;
}
if(x < root->val)
{
if(root->left == nullptr) {
root->left = createNewNode(x);
return;
} else {
bstInsert(root->left, x);
}
}
if( x > root->val )
{
if(root->right == nullptr) {
root->right = createNewNode(x);
return;
} else {
bstInsert(root->right, x);
}
}
}
int main() {
node *root = nullptr;
for (long i = 0; i < 100000; i++) {
bstInsert(root, i);
std::cout << i << std::endl; // printing output to see the results using short gives overlow.
}
}
if that does not work than you computer memory is not available as much as required it could be you only have less than 785 KB of CPU CACHE since at runtime program is in cache and with 100000 probably uses ~ 785 KB memory which in this specific case is in cache because it is at runtime and no management applied to it yet.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Abdul Rauf |
