I have recently created a ASP.NET Website using Visual Web Developer 2010. In my code, I am using these references in order to access Google Spreadsheets:
Google.GData.Client
Google.GData.Extensions
Google.GData.Spreadsheets
After pushing the project to the AppHarbor website using Git Shell, I am receiving the following errors:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Google.GData.Client". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\temp\orluajnw.mop\input\DVPT\DVPT\DVPT.csproj]
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Google.GData.Extensions". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\temp\orluajnw.mop\input\DVPT\DVPT\DVPT.csproj]
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Google.GData.Spreadsheets". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\temp\orluajnw.mop\input\DVPT\DVPT\DVPT.csproj]
How can I prevent these errors and include these references? All help would be greatly appreciated.
It seems you may be referencing those dlls from the GAC.
In that case, since they won't be available in AppHarbor's build machine's GAC, you will have to include the dlls inside the code you upload.
One easy way to do it, is to create a libs folder (at the same level where your solution is would be a good location), and place all the required dlls there.
Then remove the existing references to those dlls from your current project, and add them again but from that libs folder. Also, for each of those references, it may be necessary for you to set the CopyLocal property to True (if you click on the reference you will see CopyLocal in the Properties Tab below the solution explorer).
More info on Copy Local can be found here:
http://msdn.microsoft.com/en-us/library/vstudio/t1zz5y8c(v=vs.100).aspx
That way, AppHarbor will be able to build the code, since it will look for those dlls in that libs folder that you have just uploaded along with the rest of the code.
Related
As the title says, I want to consume all of PDFSharp's source code into my own project. But let me explain why I came to this scenario, so if there is something else I can do, maybe there are other options.
Goal: Compile my project into a single .exe file to use. No installers.
Problem: It uses PDFSharp.dll which is causing me issues.
What I am trying to do, is use ILMerge to create the .exe. I've used this successfully in the past for other projects.
The issue I think is that ILMerge is requiring references to other assemblies that PDFSharp uses. The first being Microsoft.ApplicationInsights. So to by-pass this, I installed Microsoft.ApplicationInsights into my project via Nuget. Then removed the actual reference from the project, but referenced the library in my ILMerge command as below:
/lib:"C:\<path to assembly>\Microsoft.ApplicationInsights.2.16.0\lib\net46"
This actually worked. Except, now it asked for another library and I get this error:
Unresolved assembly reference not allowed: GdPicture.NET.11.
This looks like a paid library, perhaps downloading the trial may get me past this. I didn't try yet. I switched gears as I felt I may be trying to reference an endless amount of assemblies.
I then tried to get the PDFSharp source code and I found that version 1.32 here:
https://sourceforge.net/projects/pdfsharp/files/pdfsharp/PDFsharp%201.32/
I added a reference to this project within my solution file, so now I have a solution with 2 projects. Great.
I then I tried to link source files into my project. How to do that is here:
https://jeremybytes.blogspot.com/2019/07/linking-files-in-visual-studio.html#:~:text=To%20link%20files%2C%20use%20the,CLICK%20THE%20%22Add%22%20BUTTON.
This seems to work, but every file I add requires another file, which references another file etc. It seemed endless. So that led me to the idea of just consuming the entire source code into my project and I haven't seen a good way to do that yet. I can't add a reference to the project as it just references the compiled dll which again, iLMerge can't combine.
I've also tried updating the tag within the .csproj file of PDFSharp to "module" to create a .netmodule file. This creates the file in the obj directory but throws an error:
\PDFsharp\code\PdfSharp\obj\Release\PdfSharp.netmodule' is not an assembly
Any help is appreciated. thanks.
UPDATE: I reversed everything and added the PdfSharp reference - back to where I was and changed my project to module and built which created a .netmodule file. Then used the assembly linker to create a .exe from that file. That worked using this command from VS Dev prompt.
al MyModule.netmodule /target:exe /out:MyProgram.exe /main:MyNamespace.MyClass.Main
This created the .exe, but when run without any other supporting files produces a file not found error:
System.IO.FileNotFoundException: Could not load file or assembly 'MyModule.netmodule' or one of its dependencies. The system cannot find the file specified.
Which is interesting since the module should be inside the exe right?
I have this working now, so I just wanted to place my results here since it is already posted.
My initial problem was that I mistakenly thought the PDFSharp.dll was causing the issue, but it was actually another group of 3rd Party dlls I was referencing.
I tried for hours to get iLMerge to work with the only success being it would kick out a single .exe file but it would have runtime errors.
Errors that I encountered:
Error: Unresolved assembly reference not allowed: Custom.Assembly.
Solution: Reference the assembly if possible. If you have many, you can reference a folder with the /lib:"C:\folderpath" switch.
Error: Unresolved assembly reference not allowed: ADotNetFramework.dll.
Solution: You can reference the desired .Net Framework path where iLMerge will search for missing references. Example: /targetplatform:"v4,C:<Path To Framework>.NETFramework\v4.8"
Error: The assembly 'xyz.dll' was not merged in correctly. It is still listed as an external reference in the target assembly.
Solution: You can get past this error with the /closed switch. However, I don't think I should even have gotten this error because 'xyz.dll' was a referenced dll to be combined.
Also - use the /log switch, it is extremely helpful in seeing exactly what iLMerge is doing and figuring out your issue. Example: /log:mylog.txt
This allowed me to see that iLMerge was finding duplicate namespaces, in the 3rd Party assemblies and automatically renaming them. Here is an example from my log:
Merging assembly 'My.Assembly.Name' into target assembly.
Duplicate type name: modifying name of the type '<>f__AnonymousType02' (from assembly 'My.Assembly.Name') to 'My.Assembly.Name.<>f__AnonymousType02'
Duplicate type name: modifying name of the type '<>f__AnonymousType12' (from assembly 'My.Assembly.Name') to 'My.Assembly.Name.<>f__AnonymousType12'
Duplicate type name: modifying name of the type '' (from assembly 'My.Assembly.Name') to 'My.Assembly.Name.
Finally - the solution that I found was not to use iLMerge. I found this Answer: https://stackoverflow.com/a/40786196/2596309
which used Costura.Fody
I installed the nuget package with:
Install-Package Costura.Fody -Version 4.1.0
Cleaned and built my solution and it created a single .exe file that I tested and it worked. Literally, I put 3 days of work into this and the solution took 3 minutes...
I am trying to publish an MVC app and SQL Server DB to an Azure website.
Everything builds and loads fine when I run locally from within Visual Studio. However when trying to publish to Azure, I get 13 build errors which are all basically because the DLLs for EntityFramework cannot be found.
Warning 2 Could not resolve this reference. Could not locate the assembly "EntityFramework". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. RMoney.Data
Warning 3 Could not resolve this reference. Could not locate the assembly "EntityFramework.SqlServer". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. RMoney.Data
I have enabled the option to allow NuGet to download missing packages (I added EF via nuget).
I have set all DLLs to be 'copylocal=true' too.
I have published other Azure Websites without an attached SQL DB with no problems.
Any idea what I might have done wrong?
I tried searching stackoverflow.com and google for any answers, but couldn't find anything with the same situation I have.
I am working on a solution from source control, where I am only making changes to one project in the solution. The solution has 34 project references to projects in this solution which require a whole Synergy development environment to build. Since I do not have a Synergy development environment set up, I had another developer build the projects and send me the assembly files, and I removed the project references from the project I am working on, and added assembly references instead.
Checking in actual changes to the project file are becoming a hassle, because I have to merge and remove my assembly references for the project references, and then re-do the whole process of removing project references for assembly references after checking in the change, so it will build for me again.
I was wondering if there was any way to make a project reference use reference paths, so that if the output from the project doesn't exist, it will look for the assembly in the folder specified by the reference path?
I am developing a C# application in VS 2010 that is to be deployed via ClickOnce. However when I try to deploy the application on a client machine I get the following error:
Unable to install or run the application. The application requires the assembly Microsoft.VisualStudio.Shell.Interop.9.0 Version 9.0.0.0 to be installed in the Global Assembly Cache (GAC) first.
I have tried to include the missing assembly into the application files under Project Properties->Publish tab, but the error remains the same. Next I tried to add Microsoft.VisualStudio.Shell.Interop.9.0 to the project's references, but I cannot find it in the reference list.
Does anyone have any tips or solutions to this problem. Thanks in advance.
Try this:
In Solution Explorer, right click the project name and select properties.
Go to the References tab.
Click the Unused References button.
Save and Publish.
Vron's answer is correct, it is a good idea to remove references to unused assemblies. I think if you understand why its happening then you know how to fix it. VS doesn't think you need the assembly when you publish your program because you haven't used it (as far as it can tell) but you have added it to your reference list. So it doesn't package it.
You either need to remove it from your reference list, or you need to ensure it is included in your project. To do this, show hidden, right click on the reference that is missing, click properties, and set "Copy Local" to true. Worked for me and MySQL.
Can anyone help me figure out what the problem is. I am trying to start up a C# winformsa app in visual studio and i keep getting this error:
Could not load file or assembly, Foo.dll version1.93343 or one of its dependencies
The system can't find the file specified
vs 2005, C# 2.0
any help
Typically it's about one of your references' reference, possibly deep down in the dependency tree. What I usually do is, fire up Sysinternals Process Monitor (http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx), filter by process name, and run the app. It's typically fairly easy at this point to sift through the FILE NOT FOUNDs and locate the offending missing reference.
Fire up Fuslogvw.exe and inspect which assembly (or reference) can't be found.
This is the key part: "or one of its dependencies"
I've often found that the assembly dll file that can't be loaded looks fine. However one of its dependencies (another assembly dll) does not exist or has been moved.
When the CLR loads an assembly it will also check that all of that assemblies dependencies exist. In XCopy deployment this normally means you need all the dependency assemblies in the same directory as your application exe.
Try loading the winforms executable into Reflector and under "yourApp.exe" expand the References node to see what the other referenced types are.
You must have a reference to Foo.dll somewhere and it can't be located (duh). Do you see a reference in the solution window? You can right click that and select "properties" to look at the path.
Do you see an exclamation mark on a reference in visual studio's solution explorer ?
If so, then you need to remove it then add it again.
Worth checking your global web.config hasn't got a reference to that assembly