I have a application that must run on any plain Windows installation (from Vista up to 10).
On Vista you got framework 3.5, on Win10 there's framework 4.6 installed.
To run on both, the application must target different frameworks.
Therefore I made use of multiple supportedRuntime entries in app.config, which makes this possible - works perfect.
Now I got a second problem, I have to ship app.config together with the application.
This is a problem, because of the way the application is distributed, app.config can get lost and the whole thing blows up.
So the idea was to embed app.config into the executable, against the principle of the file "user should be able to change it".
In this case, the user should not be able to change it, because it would no longer work.
Here's what I found so far:
How do you embed app.config in C# projects?
How do I compile my App.config into my exe in a VS2010 C# console app?
The essence is 'you can't do that'.
So the question is:
Is there either a way to embed app.config or is there another way to specify supportedRuntime somewhere else than app.config?
There seems to be no compiler switches that addresses the configuration.
Are there further tools to manipulate the configuration?
I'm a bit late.
I use 7zip Self-Extract feature to create an archive that will extract itself in the user's temp folder and run a specified exe. That way you can have your exe and your app.config together.
Related
I have an App Service in my Azure account which I deployed with Visual Studio Publish wizard. Is it possible to restore the deployed solution locally (in Visual Studio) from the Azure App Service?
When you publish an app to an App Service (web app), just your code is published, not the Visual Studio project / solution files. So no, unless you somehow forcibly packaged (or maybe ftp'd) a copy of your solution files, they won't be available for download.
It's fairly trivial to pull the app down to a local machine though, since Web App has built-in ftp. Just don't count on being able to retrieve source code for languages such as c# and Java (since usually just the dll/jar files are published).
I want to mention one thing which might be helpful if your application is .NET. There are many .NET Decompilation tools today(Reflector, ILSPY, JustDecompile etc.) that can open a .NET DLL and let you view the code (the best one being Telerik's JustDecompile which can create a PROJECT out of a .DLL file or any .NET Assembly)
The code will not look EXACTLY like the one you created but can get you pretty close. Definitely worth a try if you lost your code and looking for some way to get it. This will only work if the code was not obfuscated in the first place. There might some rework required but you can get somewhat close.
I have deployed a Windows Forms Application (Visual Studio 2013 C#) to a file share and will get my users to run the app from this file share. The app uses Entity Framework 6 and works fine from the file share but there is a delaying in loading the EntityFramework.dll during execution for the first time.
Is it possible to move just this dll from the file share to the local pc and tell the app to use it from the local pc?
As #tede24 stated, before trying to solve this problem, make sure EntityFramework.dll is actually your problem.
Once you make sure it is, here are the options I can think of:
1) Use ClickOnce
ClickOnce is not popular, but it still seems to be the preferred way for deploying intranet applications. Yes, it supports version checking and auto updates.
2) Use some sort of XCopy installation
You can create a batch/PowerShell to copy the application content locally from your intranet. If you want to go futher, you can even verify whether the version is the latest before launching.
3) Try putting EntityFramework in the GAC on the client machine (not recommended)
EntityFramework is not meant to be GACed, but you can still try to do that. I would strongly avoid it because of dependencies and update problems you might run into.
I have a .net console application that takes a filename as an argument, and then processes the file with some actions. What do I need to do to be able to allow a user to run my console app with the param from anywhere on the network? Do I have to install it on every machine I want it to run on, or can I just copy the .exe from the bin folder, and run it by windows cmd line? Will I need a runtime or anything for it to function properly?
AFAIK, there are two prerequisites to consider:
On the machine executing the exe, the proper version of the .NET Framework must be installed.
The environment must be configured to execute assemblies from network locations. If you're using .NET 4 or above, it should be enough to set the loadFromRemoteSources config entry as described in several places on the web, e.g. in Rick Strahl's blog post. You can find more information on the MSDN-Page for this topic.
you can put your EXE on a network so that everybody can refer to it from one place. also, the callers may need to have the right .NET framework for your EXE to run.
I made a piece of software that makes it possible for me to delete folders recursively through a console and what I want to do is make it possible to reach the program from any directory using CMD.EXE.
When I try to copy the software to the System32 directory and then run it from CMD it gives me the following error:
unable to find a version of the runtime to run this application
I tried building it as a 64 bit program but that didn't change anything.
Is there something wrong with my code or is it the way I'm building it?
Thanks in advance.
This is because the required .NET runtime you specified in your project options or in app.config file through <supportedRuntime> is not found in the system.
In short, the targeted .NET runtime for your application is not found on the system.
We have a situation where a C# application is working with SQL CE 3.5 . To allow for a legacy program to use some of its features we have produced a C++ dll which uses interop to extract the info that it needs from the C# program. For this to work, the C#-program needs to access the database. Its not a very complex scenario.
When trying to deploy with a private install some problems occur though.
There is no problem with the C# program, it can access the database and work with it without any problems.
But when trying to access functions in the C#-program through the C++ interop which forces the C#-program to access the database, we get a crash with the exception saying that "...the Provider: System.Data.SqlServerCe.3.5 is not installed".
This is obviously because we cannot add a App.config file to the executing program.
How can we get around this? Is there another way to fix this? Any other forms of SQL CE 3.5 install methods are out of the question. So we must get this to work.
Regards,
P
Edit:
I'm not working against SQL CE directly, but through Linq2SQL. I have tried to add config files to all my dll's, it does not help. It seems to only matter if the executable file have got a app.config.
The exception thrown says - The provider System.Data.SqlServerCe.3.5 is not installed.
And the latest function to be called according to the stack trace is
System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Initialize(...).
Edit 2
I have added all the files necessery for the deployment to work. As I wrote above, it works if I use the program dll (which uses Linq 2 Sql) through a .net executable with a app.config file that specifies where to look for the SQL CE 3.5 dll. Deployment will not work with only the files, an app.config file is necessary.
The problem is that we have to use the dll file through a C++ executable which have no means of telling .net where to look for the Sql Ce 3.5 dll.
add the following files to your application folder:
sqlceca35.dll
sqlcecompact35.dll
sqlceer35E.dll
sqlceme35.dll
sqlceoledb35.dll
sqlceqp35.dll
sqlcese35.dll
System.Data.SqlServerCe.dll
then it will work.
that is necessary if you have not explicitely installed sql server ce 3.5 on the target machine (which is case for most deployments i think).
You can add a foo.dll.config file and make sure it lives alongside the DLL. You just need to make sure that you have code in your DLL to determine where it lives on disk, and read the configuration from the same location.
Good luck!
This is obviously because we cannot add a App.config file to the executing program.
Why not? Okay, so Visual Studio won't automatically build the config file and rename it and move it to the output directory, but have you tried a .exe.config file alongside your C++ application?
I have also seen an instance where the System.Data.SqlServerCe.dll in the GAC was the wrong file version and I had replace the dll in the GAC from a cmd command prompt.
The point about the files having to be in the folder is true - unless the GAC gets itself confused by have multiple versions
Do not use LINQ, but use SqlCeConnection, SqlCeCommand etc for the methods you call from your C++ program