Is ILMerge broken when merging assemblies containing Lambdas in VS2010? - visual-studio-2010

I've been trying to use ILMerge to merge assemblies in VS2010 and the resulting primary assembly ends up being unusable. This only seems to occur when the assemblies being merged contain methods with Lambda expressions. Also, it seems to work fine in VS2008.
I've outlined my investigation in more detail here.
Any insight into how to solve this would be greatly appreciated.

There have been recent updates to ILMerge to fix several VS2010 compatibility problems. And there's a new command line option to target .NET 4.0. Download the latest and greatest.

Mike Barnett responded via email and informed me the problem might be in my config file somewhere. His suggestion was to use the /targetplatform option:
Ex.
ILMerge.exe /targetplatform:v4,c:\Windows\Microsoft.NET\Framework\v4.0.30319 /out:foo.exe Program.exe MathLib.dll
I added the /targetplatform and path, removed the ILMerge config file and now everything works fine.

Related

Where can I download Visual Studio 2010 merge modules for the MS11-025 security update?

I've diagnosed an installation problem to be caused by the lack of the latest VS2010 merge modules (version 10.0.40219.325) on what I believed to be a fully-patched machine. Instead, it has the older version 10.0.40219.1.
It appears that 10.0.40219.325 was introduced as part of a security update: http://support.microsoft.com/kb/2565057/en-us
I'm sure I'm missing a really obvious link somewhere, but I can't find where to download an installer for the updated (10.0.40219.325) merge modules (and I'd prefer not to copy them manually from another machine). Any help would be greatly appreciated!
I found the download link by searching for "kb2565057 manual installation". It's at
http://www.microsoft.com/en-gb/download/details.aspx?id=27049
lessmsi confirms that my merge modules in Program Files (x86)\Common Files\Merge Modules are now updated. (Hans, thanks for your help. Answering your question somehow helped me find this.)
For what it's worth, I still can't see a link to this download from the page that I found initially, and my initial searching was for MS11-025 rather than KB2565057. The lesson here for me is probably to use KB numbers when searching microsoft.com.

Importing a project into Visual Studio. Why so many errors?

This isn't really coding specific, but we currently have a project that is live and working fine. I am tasked with making a few changes to it. I imported the ALL files of the project to Visual Studio 2010. I can't get any work done, because of all the errors!
Do you have any suggestions for me? The project doesn't have a source file, so I created a project and made one myself.
I tried another version of Visual Studio, and the errors continue. How in the world is this project even working?
Also, I have no way to speak with the creator.
Thanks for the help!
Josh
Without seeing the specific errors you're running into, I'm guessing that you are hitting one of two scenarios:
The source code references .NET assemblies that you do not have installed on your development machine. The only way to correct this is to get your hands on a copy of those assemblies to install them. The assembly names should be in the error messages, which would give you a good starting point to look from.
It's also possible that differences in the .NET framework versions that it was originally developed in and what you are trying to use now are accounting for a large number of errors. If the errors specifically reference the version number, this is most likely what you're experiencing. If this is the case, there are ways you can upgrade the individual file versions that your program references, but I honestly haven't done that in about 8 years, so I'm drawing a blank at the moment as to how to do it.
I don't understand ?
you have a "project" (what kind of project?) that you want to start working with with VS2010 ?
You add the files to a new VS2010 project and start building it and many errors occur ?
What kind of errors ? Language (C++/C#) errors ? missing include missing ? missing libraries ?
Can you show a some of the errors you get ?

OctoPackPackageVersion variable not picked up in TeamCity on single project out of multiple in same solution

(TeamCity version 7.1.3 on Windows 2008 R2, using Octopack NuGet package 2.0.20 for Console applications.)
Having some weird issues here: Rather than repeat the entire thread, I was hoping I could get some takers reading my linked post (short) and maybe offer some insight.
Basic issue is stated in the title of this post.
http://help.octopusdeploy.com/discussions/problems/6435-octopackpackageversion-variable-not-usedpicked-up-in-teamcity
I have been trying to determine why in just one particular project within the same solution why it is that the OctoPackPackageVersion variable is not being passed to nuget via Octopack whereas all other projects in the solution behave as they should picking up the proper version from the TeamCity system variable defined as:
...nuget\NuGet.exe" pack "bin\Release\NuGet-temp\CaptiveAire.Core.SocketServers.ServiceHost.nuspec" -OutputDirectory "bin\Release" -basePath "bin\Release\NuGet-temp" -Version "1.0.0.0" -NoPackageAnalysis
Thanks for any assistance.
Ok so this came down to having mixed versions of OctoPack support files: targets and newer C# targets DLL for msbuild.
See the linked support page in the original question.
Hope this possibly helps someone else.

strange problem with referenced log4net assembly

I'm not sure if this problem is connected specifically with log4net or this is some problem with VS.
Everytime I'm trying, I have the same result. But let's start from the beginning.
I'm creating a simply console application (.net 4) and using nuget to install the log4net library.
Now, when I want to add some code from it, intellisense works ok:
But when I try to compile it, I have an error
This is the only one assembly I found to this moment, I have this problem with. I have absolutly no idea what (and why) is going on. I have checked with two other solutions and problem is the same. I have not checked manually downloaded version yet.
Most likely there is an underlying dependency that is missing. One very common reason is the project is using the Client Profile instead of the full .NET 4.0. (Not sure about log4Net, but I run into this a lot when including third party libraries, esp. those with ties to the web). If I am correct, simply going into properties and changing the framework version to full .NET 4.0 will solve the issue.

Make Visual Studio not care about DLL versions

Is there a way to make visual studio not care about dll versions? Is this a bad idea?
I am resetting up my dev machine and I just installed the latest version of Pex and Moles (version .92). All my projects are on version .91.
We are in the middle of a release and don't want to upgrade right now. Also, I cannot find an installer to version .91.
When I try to compile I get a message that I am missing the reference. (Hence this question)
The version is important.. By definition, there is a difference from each released version to the next (or there would be no need for a new version). Your program may not perform correctly if you are expecting one version and instead have another.
This was a part of what was known as "DLL Hell" in the pre-.NET days... If you needed to use a third party component (Crystal Reports Viewer is one we always had to deal with), you would just use the reference to whatever installed version was on the user's PC. Our retail locations had to have a specific version of Crystal Reports for their bookwork reports to print correctly, and because of that, we had to hold on to an old version forever.. Upgrading Crystal on the PC broke the vendor's bookwork app. On my first ever PC, I had several applications break when I would install or upgrade another. In particular, Real Player broke my telephone answering machine software. Goofy stuff like that...
So, the version IS important, even if it is an annoyance. It's also why I have a bias against third party tools that I have no code for, and can't recompile myself.
If you look at the properties of a referenced DLL, you will see a property "Specific Version". If you set it false, it doesn't track the specific version in the project file.
For this to work, you have to somehow fix the references where ever they are used. You can do this by opening every solution and fixing the references (at which time you could also just update the references to the correct version, paying heed to David's comments).
If you have a lot of solutions, you might use a tool like sed (see this post for windows versions of tool like this Is there any sed like utility for cmd.exe) to just update the project files as needed all at once.

Resources