A User Name That Is Not Take

We have a solution that builds multiple DLLs. When building through VS.NET, everything builds and one DLL in particular has a size of 20K and works when deployed. When building the same solution with MSBuild, that DLL is only 8K and does NOT work when deployed...and there are no errors or warnings in either case.

I have looked at the CSC.exe command-line issued by each and they appear to be identical. I have tried changing how the references in the projects are set up but I see the same results. So can anyone give me any pointers as to what may be the issue

Thanks.



Re: Visual Studio MSBuild DLL size differences when build with msbuild vs. vs.net build

Eugene Zakhareyev

What is the configuration that you are builing in VS and MSBuild Is that the same configurations Also, do you have all dependencies set for the project in question using VS UI

Regards, Eugene






Re: Visual Studio MSBuild DLL size differences when build with msbuild vs. vs.net build

DanMoseley - MSFT

Open up the assemblies in ildasm and check what it says in the Manifest section for Base Address. I think VS's compiler had a tendency to use a different one to csc.exe. I think that was fixed at some point, but I don't have the details right now. If this is the cause then either you could decide that it doesn't matter to you, or you could adjust the command line base address (using the project file) to match.

Dan






Re: Visual Studio MSBuild DLL size differences when build with msbuild vs. vs.net build

Anthony777

Did you find a solution to your problem

I have a very similar problem. I am trying to build a DLL with csc.exe. The DLL is successfully built but my application crashes when it tries to invoke a method in one of the classes. The DLL works fine if I build it in the VS IDE. Just like the problem mentioned above I notice that the size of the DLL is different. It is 20K when I build it with VS but only 7K when I build it with csc.exe.

When I build it in VS it logs the csc command line that it uses to the Output window. I am using the exact same command line so I cannot understand why I'm seeing different behaviour. I cannot see any differences when I compare the DLLs in ILDASM. And the Manifest looks the same also.

I've searched long and hard and this thread is the only one I've found which mentions this problem. Any suggestions would be greatly appreciated.

Anthony.





Re: Visual Studio MSBuild DLL size differences when build with msbuild vs. vs.net build

Anthony777

I did a Windiff on the Manifest file and found that the /filealign setting was different. I changed this and found that the size of the DLLs is now the same. But the application is still crashing in the same place. I then found the /baseaddress was different. I changed this and then everything was the same in the Manifest except for the MVID which is commented out. However, the application is still crashing.

When I do a Dump of everything from ILDASM I see there are differences. For example, it seems to be handling Classes in different order, "PE additional info" is different, etc.

As before, any suggestions would be appreciated.