I've had a ClickOnce app in use for a few months now, but recently started getting an error on my deployment of the latest version. With this latest version I've added a reference to a DLL that I hadn't used before (FTD2XX_NET.dll if it's relevant), and suspect that this is related to the issue but I cannot figure out how to fix it.
The actual project being deployed references another library project, which is what references the DLL (it references other DLL's but that has worked for months and they haven't changed). Following these threads I've tried deleting my "Local Settings/Apps" folder and rebooting multiple times, as well as recreating the project and deploying to a different location. The error exists on multiple machines so I do not suspect it's user profile corruption. Here is the full error I'm given:
PLATFORM VERSION INFO
Windows : 5.1.2600.196608 (Win32NT)
Common Language Runtime : 4.0.30319.261
System.Deployment.dll : 4.0.30319.1 (RTMRel.030319-0100)
clr.dll : 4.0.30319.261 (RTMGDR.030319-2600)
dfdll.dll : 4.0.30319.1 (RTMRel.030319-0100)
dfshim.dll : 4.0.31106.0 (Main.031106-0000)
SOURCES
Deployment url : file://nt_server/prog/Publish/Digipot%20Utility/Digipot%20Utility.application
Deployment Provider url : file://nt_server/Prog/Publish/Digipot%20Utility/Digipot%20Utility.application
Application url : file://nt_server/prog/Publish/Digipot%20Utility/Application%20Files/Digipot%20Utility_1_0_0_72/Digipot%20Utility.exe.manifest
IDENTITIES
Deployment Identity : Digipot Utility.application, Version=1.0.0.72, Culture=neutral, PublicKeyToken=1e3769a7c667fbc1, processorArchitecture=msil
Application Identity : Digipot Utility.exe, Version=1.0.0.72, Culture=neutral, PublicKeyToken=1e3769a7c667fbc1, processorArchitecture=msil, type=win32
APPLICATION SUMMARY
* Installable application.
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of \\nt_server\prog\Publish\Digipot Utility\Digipot Utility.application resulted in exception. Following failure messages were detected:
+ Value does not fall within the expected range.
COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.
WARNINGS
There were no warnings during this operation.
OPERATION PROGRESS STATUS
* [3/14/2012 10:17:15 AM] : Activation of \\nt_server\prog\Publish\Digipot Utility\Digipot Utility.application has started.
* [3/14/2012 10:17:15 AM] : Processing of deployment manifest has successfully completed.
* [3/14/2012 10:17:15 AM] : Installation of the application has started.
* [3/14/2012 10:17:15 AM] : Processing of application manifest has successfully completed.
* [3/14/2012 10:17:17 AM] : Found compatible runtime version 2.0.50727.
* [3/14/2012 10:17:17 AM] : Detecting dependent assembly Sentinel.v3.5Client, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=msil using Sentinel.v3.5Client, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=msil.
* [3/14/2012 10:17:17 AM] : Detecting dependent assembly System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=msil using System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=msil.
* [3/14/2012 10:17:17 AM] : Detecting dependent assembly NationalInstruments.Common.Native, Version=8.6.35.131, Culture=neutral, PublicKeyToken=18CBAE0F9955702A, processorArchitecture=x86 using NationalInstruments.Common.Native, Version=8.9.35.302, Culture=neutral, PublicKeyToken=18cbae0f9955702a, processorArchitecture=x86.
* [3/14/2012 10:17:17 AM] : Detecting dependent assembly NationalInstruments.Common, Version=8.6.35.131, Culture=neutral, PublicKeyToken=18CBAE0F9955702A, processorArchitecture=msil using NationalInstruments.Common, Version=8.9.35.302, Culture=neutral, PublicKeyToken=18cbae0f9955702a, processorArchitecture=msil.
* [3/14/2012 10:17:17 AM] : Request of trust and detection of platform is complete.
ERROR DETAILS
Following errors were detected during this operation.
* [3/14/2012 10:17:18 AM] System.ArgumentException
- Value does not fall within the expected range.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Internal.Isolation.IStore.LockApplicationPath(UInt32 Flags, IDefinitionAppId ApId, IntPtr& Cookie)
at System.Deployment.Application.ComponentStore.LockApplicationPath(DefinitionAppId definitionAppId)
at System.Deployment.Application.SubscriptionStore.LockApplicationPath(DefinitionAppId definitionAppId)
at System.Deployment.Application.FileDownloader.PatchFiles(SubscriptionState subState)
at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.
Thanks in advance,
Joseph
Edit: It seems the problem is spreading. On the second machine I purged all of the ClickOnce files in the "Local Settings/Apps" so I had to reinstall an old program. When I went to do so it gave me the same error. This program was last updated in February. In response I tried totally removing and reinstalling the .NET framework to no avail.
My cure was a bit different. I was only having problems on one of 3 machines at my workplace. After trying most, if not all, of the solutions above I tried this:
Cleared out my AppData folder but it was hard to find. Mine was located here:
C:\Users\%usernamefolder%\AppData\Local\Apps\2.0\PN1V0WLG.QB8\2RVAAAH2.PA9
this portion "PN1V0WLG.QB8\2RVAAAH2.PA9" might be unique to my machine. But in the 2RVAAAH2.PA9 there were some folders whose name started with the first 4 letters of my application name:
Eg. "prog...exe_f9d3a3c4fe2dee3c_0001.0000_none_81c53bb624457ad3"
I went ahead and actually deleted all folders in the 2RVAAAH2.PA9 directory as they all seemed to pertain to my program or references in my program. I could tell some of them were related to Telerik DLLs that I use so I dumped them too.
I then re-installed my program and it worked.
Looks like it could be several issues take a look and see if any of them help
Check and see if there is a & in the path of the application
http://connect.microsoft.com/VisualStudio/feedback/details/361607/clickonce-application-does-not-install-when-the-deployment-path-includes-ampersand
also take a look at this
We used to target "any cpu", and had to change it to x86 in order to get it to work on 64-bit machines. For us, this is because we use DirectX, and it only supports 32-bit machines. So even though we put all of the DirectX code in its own project that targeted x86, we had to have our startup project also target x86.
http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/9e4b714e-bad4-4c62-a7ad-3c80e32d95eb/
It appears to be caused by an unknown change in the .vbproj file. If you have source control, or backups of your files, restoring an old version of the .vbproj file and republishing seems to fix the problem. You may or may not have to uninstall on the target machine if they tried to run the bad publish.
http://connect.microsoft.com/VisualStudio/feedback/details/437590/value-does-not-fall-within-the-expected-range-click-once-deployment-failure
Make sure you don't have any mismatched version numbers on any dlls , or any circular references.
http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/9e4b714e-bad4-4c62-a7ad-3c80e32d95eb/
So I found a solution, at the advice of the non-"Answer" solutions on this thread I turned off automatic version incrementing and manually updated the Assembly and File version in the Project settings under "Application > Assembly Information..." and it worked.
Remove any & from the Folder name if there is any & in the folder name. I was also having same problem for this reason.
Reference:Check Here
The workaround is just to uninstall and reinstall the application. I have yet to find a solution to the error itself, and why it happens so randomly. I will release a new version, and it will happen to one other person, and nobody else. I just released a new version a few minutes ago, and it screwed up my version on my machine, and nobody else's. I have yet to figure out a solution, since when I publish it works on most machines, but not on a couple. Has been this way for literally 12 years.
If you are trying to run the clickonce on a UNC share, it may not work. I was getting the same result as yours above, but I just tried deploying to C:\ instead of our share, and it runs just fine. I know this isn't a solution, but at least it's a clue - not sure if this has to do with Authentication... or something deeper. Man, I wish the error message was more helpful.
Platform target: Any CPU (msil) was definitively the problem for me: Setting to x86 solved the problem
I switched publish location to C:\Temp.
The installed failed but this time told me I had an existing install from another location.
After a bit of poking around, I found I could fix the problem by:
1. Use Control Panel to uninstall my application.
2. Delete publish folder contents.
I haven't been able to figure out what steps actually produce the problem but its gone now for the the time being.
In case, any one facing similar issue with WPF application, please take a look at my answer here.
I had this problem with an old app that had some hard-to-find pre-requisites. I found that VSTO does a nice roll-up of a lot of those files (making it a simple troubleshooting step, or simple solution). It helped me with a few old computers:
Visual Studio 2010 Tools for Office Runtime:
https://www.microsoft.com/en-US/download/details.aspx?id=48217
Related
I've recently been tasked with adding a report to an older WPF application. Part of the process involved adding ActiveReports to the solution in question.
After getting the report implemented and tested on my local machine, it came time to commit it up to our Dev/Test build environments. Everything went fine, until I attempted to run the application on a machine that did not have ActiveReports installed and licensed on it - I got the "Viewer needs to be licensed error window."
Here's where things get confusing, though. It should be working.
For starters, I'm running ActiveReports 8.0.133.0.
The contents of my licenses.licx file are:
GrapeCity.ActiveReports.SectionReport, GrapeCity.ActiveReports.v8, Version=8.0.133.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff
I've generated a satellite licensing DLL for the WPF project's executable, and ensured that it's referenced and set to Copy Local = true. (I've already dealt with this in the past.)
Even though it's not a web project, for safety's sake, I used the WebKey Generator and added an Active Report 8 Developer key to the app.config file.
It gets more interesting, though. When I add the following lines to my licenses.licx file, as the error window I get above suggests I should do:
GrapeCity.ActiveReports.Viewer.Win.Viewer, GrapeCity.ActiveReports.Viewer.Win.v8, Version=8.0.133.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff
GrapeCity.ActiveReports.Viewer.Wpf.Viewer, GrapeCity.ActiveReports.Viewer.Wpf.v8, Version=8.0.133.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff
When I try to simply build the project in Dev, the build fails with the following message:
[10:29:34] [exec] (CompileLicxFiles target) ->
[10:29:34] [exec] Properties\licenses.licx(2): error LC0004: Exception occurred creating type 'GrapeCity.ActiveReports.Viewer.Win.Viewer, GrapeCity.ActiveReports.Viewer.Win.v8, Version=8.0.133.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff' System.ComponentModel.LicenseException: License cannot be confirmed. Error code: 01-001 [C:\CheckoutDirectory\Project\[(0) BUILD]\UI\UI.csproj]
[10:29:34] [exec] Properties\licenses.licx(3): error LC0004: Exception occurred creating type 'GrapeCity.ActiveReports.Viewer.Wpf.Viewer, GrapeCity.ActiveReports.Viewer.Wpf.v8, Version=8.0.133.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff' System.ComponentModel.LicenseException: License cannot be confirmed. Error code: 01-001 [C:\CheckoutDirectory\Project\[(0) BUILD]\UI\UI.csproj]
For those who don't want to scroll:
System.ComponentModel.LicenseException: License cannot be confirmed. Error code: 01-001
The end result is a sort of Morton's Fork of badness. Either I can build the app, but I can't run the report (which, is sort of the point of me making these changes), or I simply can't build the app at all.
Question: What can I do to get the report viewer to run without a license exception and keep the application building? I should also note, I'm on a short deadline with this!
I was correct to add the Win and WPF viewer lines; it turns out the answer was to upgrade the Build server with Active Reports 8. From there, everything went swimmingly.
TL;DR - Upgrade everything that needs to be upgraded!
The problem:
When deploying my applications to the production database i get the following error:
Could not load file or assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
at ConsoleApplication2.Database.DBConnect.Initialize(String username, String password, String IP)
at ConsoleApplication2.Database.DBConnect..ctor(String username, String password, String IP) in C:\Users\Vincent\Documents\Visual Studio 2008\Projects\ConsoleApplication2\ConsoleApplication2\DBConnect.cs:line 26
at ConsoleApplication2.Database..ctor() in C:\Users\Vincent\Documents\Visual Studio 2008\Projects\ConsoleApplication2\ConsoleApplication2\Database.cs:line 20
at ConsoleApplication2.Main..ctor() in C:\Users\Vincent\Documents\Visual Studio 2008\Projects\ConsoleApplication2\ConsoleApplication2\Main.cs:line 16
What i know: it isn't actually the System.Data.dll that has a problem.
Since I've started making a clean console application.
First just using Console.write(). when that worked i made a new class and did some general computations (also without problems) than I decided to create a MySQL connection using the MySQL.data.MySqlClient; from the Mysql.data.dll this is when the error occured again. I got the dll from the mysql site.
the strange part:
this dll has always worked on my computer (on which I created the applications) and on 2 different servers (1 of which I set up just for testing these applications to see if i would get the same problem)
some specs:
my computer runs windows 7 32 bit.
the production database runs windows 2003 service pack 2 as do the test server and the other server I've tried it on.
Some other stuff I've done:
I have created an installer (.msi and .exe) both install .net 3.5 service pack 1 and .net 2.0 service pack 2.0 and .net 3.0 service pack 2.
i found it strange that it would install all those .net frameworks but to install 3.5 you need 2.0 so that made sense (not sure about why it installed 3.0 though)
I've also tried running the application without the MySQL connector installed (so just place the mysql.data.dll in the application folder) and I've tried with the MySQL connector installed (so no dll's in the application folder)
I've tried copying my .net framework to the production database (this was before i knew it was about the mysql.data.dll and not the system.dll or system.data.dll)
I've tried everything i could think of yet nothing works, it works fine on all other computers/databases just not on the 1 we want to deploy the application...
The code where the error occurs:
public DBConnect(string username, string password, string IP)
{
Console.WriteLine("dbconnect contsrutctor");
Initialize(username, password, IP);
}
private void Initialize(string username, string password, string IP)
{
Console.WriteLine("initializing strings");
string server = IP;
string database = "";
string connectionString;
connectionString = "SERVER=" + server + ";" + "DATABASE=" +
database + ";" + "UID=" + username + ";" + "PASSWORD=" + password + ";";
Console.WriteLine("initializing mysqlconnection");
//MySqlConnection connection = new MySqlConnection(connectionString);
}
i have commented the line:
MySqlConnection connection = new MySqlConnection(connectionString);
and the applications runs without errors, when I un-comment it the error occurs again.
EDIT
I have noticed a strange thing: when ever it gets to the method (not the line) of where the MySqlConnection is created the error is thrown. If you would look at the above code sample the first Console.WriteLine("initializing strings"); does not even show in my console. I find this quite strange since you would expect the error to be thrown on the MySqlConnection connection = new MySqlConnection(connectionString); line and not at the start of the method.
EDIT 2
I thought i found an answer so i posted it:
"Though i have checked the system.data.dll and system.dll versions and
file paths (which were exactly the same on all 3 machines I did find
the problem to be with these files.
In my application I've set the "copy local" to true and after this it
worked.
I find this extremely odd since I've tried replacing the dll's on the
production server with my own and this did not work. also just placing
the dll's in the application folder did not help either. I had to
specifically specify the application to copy the dll's it self.
anyway it's working properly now although I'm not quite convinced i
like this solution...
I definitely do not like this because i need to do this to half of the
dll's (yes half not all just about half of them).
any better options are still welcome."
however I failed to mention it worked on my test application, the real application can't find system.transactions this time. so it's still not the right solution though it did clear the error about the system.data.dll i still can't run the program because of a similar error for a different file.
So since i'm still having the same error but on a different file (which i can't change the "copy local" setting to true since it's not referenced by me) i've deleted the answer and placed it here as an edit since the problem still isn't solved.
EDIT 3
I've run Fuslogvw.exe and this is the result:
* Assembly Binder Log Entry (12/5/2013 # 8:43:13 AM) *
The operation failed. Bind result: hr = 0x80070002. The system cannot
find the file specified.
Assembly manager loaded from:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll Running
under executable C:\Program Files\Custommate\email sorteer
service\EmailSorteerService.exe
--- A detailed error log follows.
=== Pre-bind state information === LOG: User = NAVMATE\Administrator LOG: DisplayName = System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 (Fully-specified) LOG: Appbase =
file:///C:/Program Files/Custommate/email sorteer service/ LOG:
Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base =
NULL LOG: AppName = NULL Calling assembly : EmailSorteerService,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
=== LOG: This bind starts in default load context. LOG: No application configuration file found. LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 LOG: GAC Lookup was unsuccessful. LOG:
Attempting download of new URL
file:///C:/Program
Files/Custommate/email sorteer service/System.DLL. LOG: Attempting
download of new URL
file:///C:/Program Files/Custommate/email sorteer
service/System/System.DLL. LOG: Attempting download of new URL
file:///C:/Program Files/Custommate/email sorteer service/System.EXE.
LOG: Attempting download of new URL
file:///C:/Program Files/Custommate/email sorteer service/System/System.EXE. LOG: All
probing URLs attempted and failed.
Meaning it's trying to load the dll's from the folder i'm running the application from, i find this strange since i don't know what is causing this. (I have made sure copy local is set to false so that couldn't be the problem)
so the new question: how do i make sure it loads it from the right place?
The reason why the exception is thrown as soon as you enter the method is simple - the JIT compiler only needs to resolve the references then. MySqlConnection requires System.Data, and it's the first method to do so, so that's when the exception is thrown.
As for debugging the issue, it does seem like improperly installed .NET framework on the target machine. You should try How to enable assembly bind failure logging (Fusion) in .NET to have a look at where .NET is actually trying to find the library, and why it discards any that it finds at all.
If it doesn't lead you to solve your problem, I'd try uninstalling and reinstalling .NET framework 2.0, and then 3.5.
The reason Copy Local sort of works is because then the application doesn't try to load the DLL from the Global Assembly Cache, but rather from the executable directory of your application. However, your real problem is that it isn't finding the right DLL in GAC.
If Fusion shows you that the MySQL library tries to load a wrong version of System.Data, you can use an application manifest to force it to load a different version (which should hopefully be compatible). You can read about application manifests here - http://msdn.microsoft.com/en-us/library/aa374191(VS.85).aspx
Good luck.
Whenever I have seen issues like this, it is because I have not deployed the correct version of the library in question or because I am actually missing a library. I think others already referenced this but I wanted to repeat to emphasize that this is the main issue.
In order to solve these sorts of issues you can do two things. First, understand the order in which libraries are loaded:
Look in the Global Assembly Cache (GAC)
Search the folder your program is running from
Search the current directory
Search the system folder (System32 or SysWow64)
Search any other folders in the environment %PATH% variable
Once you understand that, you can look in each of these locations for wrong or conflicting versions of the library that you are referencing. Since System.Data is a library that comes with .NET I would guess that your build computer has a different version of .NET installed than you have on your computer you are trying to deploy to.
The other thing that I have found to be really helpful is a tool called fuslogvw.exe (http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.110).aspx). If you follow the instructions on the FusionLog site you can trace .NET as it tries to load various assemblies. Simply enable the tool then check the logs file after you get the error. This should indicate where .NET was looking for the file and possibly why it failed.
As others said - best of luck!
To find a which .dll it is ultimately failing to find ("or one of its dependencies" in the error message) and from where it is attempting to load it you can try Process Monitor from the SysInternals suite.
It's a simple download, unzip, and run in place. I suggest you then add a filter for your app's name (or whatever else you can use to uniquely identify it) and then just watch for it to try to load a .dll and fail. You can apply more filters to narrow down the list of events such as Operation is QueryNameInformationFile (first event it tries when locating a file). Note that for a lot of .dlls it will try a few places before ultimately finding a copy, so you're looking for a series of events referencing the same file name with no Success result at the end.
Best of luck.
I had this error when Windows update was installing .Net 4.5.2 at the same time I was debugging my code in 4.5.1.
I had the same problem,
First, you must copy your reference dll file into the bin folder of the main project that uses it and include the file at the references section of the main project inside VS.
Second, if you are using your main project as a library project and including it inside another project (a second project) then add the same reference dll file into the bin folder of this second project and also include this copied file at the references section of the second project at VS.
This workaround solved my problem, I hope it helps you too.
I'm having little problem running my C# application after switching to Windows 8.1 from 8.
The problem is that I get this exception from title and there's not much help online. I tried to pinpoint the problem and it seems like my x64 application is trying to call x86 CSharp library. The reference in project leads to a DLL file, that upon calling x64 dumpbin program with /headers parameter outputs:
Dump of file Microsoft.CSharp.dll
PE signature found
File Type: DLL
FILE HEADER VALUES
14C machine (x86)
3 number of sections
4FFA5C64 time date stamp Mon Jul 09 06:21:56 2012
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
2022 characteristics
Executable
Application can handle large (>2GB) addresses
DLL
Notice the machine is x86, while the application is running in x64 (checked with Environment.Is64BitProcess). This might be the problem I'm facing, however I can't find way to solve it - there seems to be no x64 .Net libraries installed. The only ones I have found are at: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework. Or maybe I'm completely off and there's some other problem. Anyway the exception occurs at startup in one of constructors and full detail is:
Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
"Could not load file or assembly 'Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest."
Edit:
While still panicking, I solved this by downloading CSharp.dll and replacing the dummy 0-byte file in path shown in answer by it.
The module was expected to contain an assembly manifest
You've been looking at a reference assembly, it is not the one that's actually loaded when you run your program. Microsoft.CSharp.dll is stored in the GAC, put there by the .NET installer. You can see the file by navigating to c:\windows\microsoft.net\assembly\gac_msil\microsoft.csharp. Keep clicking until you get to the file.
The exception message is a very unhealthy one, it doesn't recognize the DLL as a .NET assembly. There are few decent explanations for that, other than the file being corrupted. File corruption is always bad news, a strong hint that your hard-disk is failing. You'll need to get it fixed, follow-up if necessary at superuser.com
I have this exception generated on some user machines (~1 of 20):
Could not load file or assembly 'System, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies. The system cannot find the file specified.
I found several references to this error over the web and this site but nothing helped.
I have an add-in application which uses WCF to connect to the server. The add-in built with .NET Framework 3.5 with VS 2008.
The error is reproducible on one of the test machines in only one user account. I install my application and can only reproduce this from one account on this machine everywhere else it is working fine. Furthermore it is only reproducible with only one version of host application which I created add-in for (I assume because it uses differnet .NET Frameworks).
I have checked the fuse logs and I see the following:
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable C:\Program Files\SolidWorks Corp\SolidWorks\sldworks.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = Home\User
LOG: DisplayName = System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = file:///C:/Program Files/SolidWorks Corp/SolidWorks/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
So by some reasons it is trying to use v2.0.50727\mscorwks.dll loader to load the Version=4.0.0.0 of System.dll. On build machine I'm referring 2.0.0.0 version of System.dll.
I had this same problem - some users could pull from git and everything ran fine. Some would pull and get a very similar exception:
Could not load file or assembly '..., Version=..., Culture=neutral, PublicKeyToken=...' or one of its dependencies. The system cannot find the file specified.
In my particular case it was AjaxMin, so the actual error looked like this but the details don't matter:
Could not load file or assembly 'AjaxMin, Version=4.95.4924.12383, Culture=neutral, PublicKeyToken=21ef50ce11b5d80f' or one of its dependencies. The system cannot find the file specified.
It turned out to be a result of the following actions on a Solution:
NuGet Package Restore was turned on for the Solution.
A Project was added, and a Nuget package was installed into it (AjaxMin in this case).
The Project was moved to different folder in the Solution.
The Nuget package was updated to a newer version.
And slowly but surely this bug started showing up for some users.
The reason was the Solution-level packages/respositories.config kept the old Project reference, and now had a new, second entry for the moved Project. In other words it had this before the reorg:
<repository path="..\Old\packages.config" />
And this after the reorg:
<repository path="..\Old\packages.config" />
<repository path="..\New\packages.config" />
So the first line now refers to a Project that, while on disk, is no longer part of my Solution.
With Nuget Package Restore on, both packages.config files were being read, which each pointed to their own list of Nuget packages and package versions. Until a Nuget package was updated to a newer version however, there weren't any conflicts.
Once a Nuget package was updated, however, only active Projects had their repositories listings updated. NuGet Package Restore chose to download just one version of the library - the first one it encountered in repositories.config, which was the older one. The compiler and IDE proceeded as though it chose the newer one. The result was a run-time exception saying the DLL was missing.
The answer obviously is to delete any lines from this file that referenced Projects that aren't in your Solution.
I got this after downgrading a project from .net 4.5 to .net 3.5.
To resolve I had to go in to the project - properties - settings window and delete all my settings, save the project, exit and restart visual studio, go back into project - properties -settings window and re-enter all my settings and their default values
This worked for me.
Go to Project->Propertied->Target Frawork->Change frame work like 3.5 to 4.0
I had the problem under Linux and I needed to install those. I don't know which one actually fixed the problem, but that error was gone after that:
apt-get install mono-utils mono-runtime-sgen mono-runtime-common \
mono-runtime-boehm mono-runtime-dbg mono-xbuild
I've seen this a couple times, and it is usually fixed by running a repair on .NET Framework (whichever version the application is trying to use).
You are using .net 4? - Maybe on the clients there is only the ".net framework 4 client profile" installed. Try to install full package!!
Download here
In my case, I was able to find issue with ScriptManager by setting Debug=true in web.config file
I answered too late but it has worked in my case.If you are facing this issue in your project please add the following line in your web.config :
<compilation batch="false" >
This worked in my case. If you already have compilation tag in your web.config then add only batch="false" property to it.
You can enable NuGet packages and update you dlls. so that it work.
or you can update the package manually by going through the package manager in your vs if u know which version you require for your solution.
Even I have experience some more strange things, I can see there is no dll in GAC from where the dll is loading but windows > Module shows system.dll version=4.0.0.0 loaded
i just changed my target .net framework and it worked .in my case i changed from .net 4.7 to .net 4.
Right click your solution and select properties
selct properties
Click Application >> Target Framework
FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
this is my problem. I installed system.configuration assembly in the project and other class libraries also. now the problem has gone.
am used net 6.0 with aspcore.report and problem like this happened with me
I installed system.configuration assembly in the server project problem solved
This is a Windows 7 machine with Service Pack 1, and I published a C# WPF application using x86 target platform configuration since it also needs to be installed on XP machines.
The problem I'm dealing with is becoming a nuisance. The application runs fine in Visual Studio 2008 debug mode. After running the setup executable generated from publishing, the installation completes successfully (or at least appears that way), but when it attempts to open, I get the Application cannot be started. Contact the application vendor. message box.
Here is the Error Summary section of the log file:
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of http://ServerPath/MyApplication_Install/Release/x86/MyApplication.application resulted in exception. Following failure messages were detected:
+ Value does not fall within the expected range.
And the Error Details section:
ERROR DETAILS
Following errors were detected during this operation.
* [9/12/2012 8:15:42 AM] System.ArgumentException
- Value does not fall within the expected range.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.NativeMethods.CorLaunchApplication(UInt32 hostType, String applicationFullName, Int32 manifestPathsCount, String[] manifestPaths, Int32 activationDataCount, String[] activationData, PROCESS_INFORMATION processInformation)
at System.Deployment.Application.ComponentStore.ActivateApplication(DefinitionAppId appId, String activationParameter, Boolean useActivationParameter)
at System.Deployment.Application.SubscriptionStore.ActivateApplication(DefinitionAppId appId, String activationParameter, Boolean useActivationParameter)
at System.Deployment.Application.ApplicationActivator.Activate(DefinitionAppId appId, AssemblyManifest appManifest, String activationParameter, Boolean useActivationParameter)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
There are other ClickOnce questions on here that deal with Microsoft.Vbe.Interop, Version=14.0.0.0 - that does appear in this log file under the OPERATION PROGRESS STATUS section, but it doesn't say the assembly needs to be installed in the Global Assembly Cache.
* [9/12/2012 8:45:19 AM] : Detecting dependent assembly Microsoft.Vbe.Interop, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C, processorArchitecture=msil using Microsoft.Vbe.Interop, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=msil.
* [9/12/2012 8:45:19 AM] : Detecting dependent assembly Microsoft.Vbe.Interop, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C using Microsoft.Vbe.Interop, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c.
Do I need to remove leftover files/folders from previous installations? That's my gut feeling, but I don't know where to look inside the AppData/Local/Temp or Windows/System32 folders.
Edit
I did some deep digging and found the executable for my application here:
C:\Users\MyUsername\AppData\Local\Apps\2.0\A30V87AA.25Q\PQ06CCDW.CYM\wpfb..tion_41f7e986af356c0c_0004.0004_b15da840f06645a3\MyApplication.exe
It loaded up without any errors. And to confirm this was from the installation, not my source code, I did an uninstall in Control Panel, checked that directory and all the files were gone.
After re-installing from setup.exe, a different set of jibberish folder directories were made, but I was still able to run the application.
So why does the Application cannot be started. Contact the application vendor. message pop up after installation, even though there is a working copy deep inside the AppData directory?
Edit #2
As suggested by jvanh1, I ran as an administrator to see if that made any difference. Unfortunately it didn't.
I was forced to checkout the latest tagged version and do some manual copy/pasting - the subsequent publish actually worked. The more important issue here is that we never have used branching before in our version control (at least not for this application), so I convinced my manager to let me give it a shot.
I will continue to investigate what caused this annoying ClickOnce publish problem in the first place - my guess is different sets of references in the tagged version vs. my working copy.
I encountered a very similar issue, it turns out one of the reference dll was moved but the hintpath wasn't updated. VS didn't warn me, instead it automatically referenced the GAC copy, causing a prerequisite change. I fixed the issue by replacing the GAC reference with local dll reference.