|
|
Comments and Discussions
|
 |

|
Hi Maria,
I'm trying to use sln2mak to work with VS2010 solutions, and i think i have made the necessary changes to the sln2mak project, just as PeterFig put it.
(1)Set Target Framework to 4.0 (right click your project node, click “Properties”, click “Application” tab, set the target framework to .net framework 4.)
(2)Add a reference to Microsoft.VisualStudio.VCProjectEngine (that got rid of the old reference to 8.0 that was yellow-flagged)
(3)Add a reference to Microsoft.CSharp
the sln2mak can be compiled successfully, but i got a System.Runtime.InteropServices.COMException with the following code when trying to run the exe:
VCProjectEngine vcprojEngine = new VCProjectEngineObject();
it seemed that a question in the stackoverflow had solve the COMException by changing platform target to x86. Well, the COMException did indeed disappear but a System.InvalidCastException is caused, saying :
An unhandled exception of type 'System.InvalidCastException' occurred in ProjectEngine.exe
Additional information: Unable to cast object of type 'Microsoft.VisualStudio.Project.VisualC.VCProjectEngine.VCProjectEngineShim' to type 'Microsoft.VisualStudio.VCProjectEngine.VCProjectEngineObject'.
I tried to find a solution to fix this InvalidCastException but with little success.
can you kindly give me any hits?
i am looking forward to hearing from you.
Thanks and best regards.
shuai
http://stackoverflow.com/questions/4021796/error-80040154-class-not-registered-exception-when-initializing-vcprojectengin[^]
http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/f8c373da-9c3c-427d-a46c-b8739071eb1b[^]
modified yesterday.
|
|
|
|

|
I am working on a big fortran solutions with 4 projects that was already implemented in Visual Studio. I need a makefile for that so I can continue working in linux.
May I use sln2mak to generate makefiles from Visual Studio fortran solutions and projects?
|
|
|
|

|
You should download the code and customize it, because project files have different extensions. For additional, i am pretty sure that fortrain project may have different flags for compiler and linker, but the main solution design should be fine, only some small changes.
There is nothing impossible.
|
|
|
|

|
Debugging the application in VisualStudio 8, on
VCProjectEngine vcprojEngine = new VCProjectEngineObject();
I get the following error:
COMException was unhandled
Recupero della class factory COM per il componente con CLSID {FBBF3C66-2428-11D7-8BF6-00B0D03DAA06} non riuscito a causa del seguente errore: 80040154.
The reference in the Solution Explorer seems to be ok, but it doesn't work.
Can you give me a hint?
Thank you in advance.
Alessandro Piersanti.
|
|
|
|

|
I am not familiar with this error, try google it.
Or remove and add again the reference.
There is nothing impossible.
|
|
|
|

|
You may need to run regsvr32 on the VCProjectEngine dll.
|
|
|
|

|
There is nothing impossible.
|
|
|
|

|
Dear Maria,
I tried to compile many times and here is my error below(I added sln2mak in the *.sln folder then run)
C:\Users\PicTrans_src\PicTrans>sln2mak.exe PicTrans.sln
sln2mak.exe - Generates a Makefile from a .sln/.vcproj file .
c Maria Adamsky (www.EFC.CO.IL)
Creating file Makefile...
Going to read project file 'PicTrans/PicTrans.csproj'
aiming to write result to file 'PicTrans/PicTrans.csproj'
With no dependencies.
Unhandled Exception: System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {FBBF3C66-2428-11D7-8BF
6-00B0D03DAA06} failed due to the following error: 80040154.
at sln2mak.VcProjInfo..ctor(String vcProjFile, String outFile, String[] projDependencies)
at sln2mak.VcSlnInfo.iSendToParseVcprojFiles()
at sln2mak.VcSlnInfo.GenerateMakefile(Boolean parseVcproj)
at sln2mak.VcSlnInfo.GenerateMakefile()
at sln2mak.Parser.ParseSln(String projName, String slnFName)
at sln2mak.Program.Main(String[] args)
Pls advise me and i am looking forward to hearing from you.
Thanks and best regards
|
|
|
|

|
Hi,
Is your solution VS2008?
If so, read "Important notes" section that explains what reference should be replaced to work with VS2008 projects.
Regards, Maria.
There is nothing impossible.
|
|
|
|

|
On second opinion, it could be because you placed the tool into the same folder where sln is, put it on separate folder, but on passing to it arguments give the whole solution path.
I hope it will help.
Regards,
Maria.
There is nothing impossible.
|
|
|
|

|
I am getting the same exception in the VcProjInfo ctor. The tool is not in the same folder. I am using VS2010 and replaced the reference per my message below (VS 2010 thread). Mine says "Class not registered." It certainly sounds like a VS configuration problem and not anything wrong with your code. Still, I don't what to do (I don't understand the error or what is causing it).
|
|
|
|

|
Dear Maria,
I am have VS2005 solution . I am trying to generate Makefile
I am getting following exception :
E:\Internal_project\sln2mak>sln2mak.exe E:/Project/abc_11252/abc.sln
sln2mak.exe - Generates a Makefile from a .sln/.vcproj file .
c Maria Adamsky (www.EFC.CO.IL)
Creating file E:\Project\abc_11252/Makefile...
Unhandled Exception: System.Collections.Generic.KeyNotFoundException: The given
key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at sln2mak.VcSlnInfo.iPrintDefaultTargetRule()
at sln2mak.VcSlnInfo.GenerateMakefile(Boolean parseVcproj)
at sln2mak.VcSlnInfo.GenerateMakefile()
at sln2mak.Parser.ParseSln(String projName, String slnFName)
at sln2mak.Program.Main(String[] args)
|
|
|
|

|
It happened when the name of the project in .sln file was different from the name in the .vcproj.
|
|
|
|

|
In this case, see the usage.
There is nothing impossible.
|
|
|
|

|
Indeed, that fixes the issue, but I didn't knew the crash cause without a little debugging
|
|
|
|

|
I had the same problem, I fixed it by compiling it as x86 instead of "any CPU" or x64.
|
|
|
|

|
gives me stack dump on each/any run
|
|
|
|

|
Not too much information....
There is nothing impossible.
|
|
|
|

|
Hi, Maria!
I can't download the zip files(sln2mak.zip and sln2mak_bin.zip). Can you email them to my emailbox: fanghongbing@126.com?
Thanks
|
|
|
|

|
How about Visual Studio 10 and 11?
|
|
|
|

|
I never tested it on VS 10 and 11, but i don't think it should be problem. Just convert the project and replace maybe the reference to VCProjectEngine.
There is nothing impossible.
|
|
|
|

|
To get sln2mak to build in VS2010, I did this:
(1)Set Target Framework to 4.0 (right click your project node, click “Properties”, click “Application” tab, set the target framework to .net framework 4.)
(2)Add a reference to Microsoft.VisualStudio.VCProjectEngine (that got rid of the old reference to 8.0 that was yellow-flagged)
(3)Add a reference to Microsoft.CSharp
Now let's see how well it works!
|
|
|
|

|
I'll be glad to hear how it worked.
There is nothing impossible.
|
|
|
|

|
Peter, did you ever get this to work? I'm using VS2012 -- when I try to allocate a VCProjectEngine as follows:
VCProjectEngine m_vcprojEngine = new VCProjectEngineObject();
I get the following error:
Retrieving the COM class factory for component with CLSID {4547A58D-FC1C-4502-84
FA-0163EE766635} failed due to the following error: 80040154 Class not registere
d (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
I've tried the mechanism to register the .dll that worked in VS2008 (using regsvr32) but that does not work on the new VS2012 .dll. Any suggestions much appreciated.
|
|
|
|

|
not functional: can not find path error or argument length less than zero error
|
|
|
|

|
Works fine in XP.
You are not the first with this error, try follow answers posted earlier.
There is nothing impossible.
|
|
|
|

|
I was wondering if you or anyone else has tried using on a Win 7 32 machine? Specifically recompiling on the Win 7 platform (with MSVS 2008) and run the sln2mak exe on the same platform. I have not been able to have it run without crashing.
Unhandled Exception: System.Collections.Generic.KeyNotFoundException: The given
key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at sln2mak.VcSlnInfo.iPrintDefaultTargetRule()
at sln2mak.VcSlnInfo.GenerateMakefile(Boolean parseVcproj)
at sln2mak.VcSlnInfo.GenerateMakefile()
at sln2mak.Parser.ParseSln(String projName, String slnFName)
at sln2mak.Program.Main(String[] args)
|
|
|
|

|
A have same problem. Win 7 Ultimate, 64-bit.
Creating file Makefile...
Neošetřená výjimka: System.Collections.Generic.KeyNotFoundException: Daný klíč není ve slovníku k dispozici.
v System.ThrowHelper.ThrowKeyNotFoundException()
v System.Collections.Generic.Dictionary`2.get_Item(TKey key)
v sln2mak.VcSlnInfo.iPrintDefaultTargetRule()
v sln2mak.VcSlnInfo.GenerateMakefile(Boolean parseVcproj)
v sln2mak.VcSlnInfo.GenerateMakefile()
v sln2mak.Parser.ParseSln(String projName, String slnFName)
v sln2mak.Program.Main(String[] args)
(I'm sorry, but I have a Czech distribution of Windows.)
|
|
|
|

|
There is nothing related to Win7 or 64 bit or Czech distribution, just wrong argument line or solution structure is not tool expects. You are not the first with this error, try follow answers posted earlier.
There is nothing impossible.
|
|
|
|

|
Very good software! It works fine and fast, really it is a very nice tool.
I have used it successfully ... after a small modification. I quickly expose it here if it can help.
My SLN links towards some directories where there is no vcproj; the application crashes somewhere when parsing, with a great message:
Exception: System.ArgumentOutOfRangeException: The length cannot be negative.
Name of parameter : length
in System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
...
In order to do the job correctly, I have put a little test when parsing the names of sub-projects (file VcSlnInfo.cs, line 113):
if (matchProjInfo.Groups[3].Value == matchProjInfo.Groups[2].Value)
{
continue;
}
Basically, it is just based on the fact that the parsing put the name of the directory if no vcproj is found. This a little rough ... but it works after all .
|
|
|
|

|
Thank you
There is nothing impossible.
|
|
|
|

|
Hello!
I had some troubles running the application when ONLY ONE vcproj file is passed as argument.
The following methods throws an exception since no path for solution file is set:
iPrintTargetRules ( ) ; iPrintClenOrDependsRules ("clean" ) ;
I think the line
Int32 stripStart = Path.GetDirectoryName(m_SlnFullPath).Length + 1;
must be replaced with
Int32 stripStart = (m_SlnFullPath != String.Empty) ? Path.GetDirectoryName(m_SlnFullPath).Length + 1 : 0;
In order to avoid those exceptions.
Thanks a lot!!!
|
|
|
|

|
If you run the tool with one vcproj and use for it 'case 3' arguments template, then the code will never reach those lines you try to fix
There is nothing impossible.
|
|
|
|
|

|
Hello Maria,
Firstly I'd like to say thank you - I've just been using your tool to generate makefiles and it has saved me hours!
I had a problem with some of your code that I don't fully understand:
Int32 stripStart = Path.GetDirectoryName(m_SlnFullPath).Length + 1;
Int32 stripLength = m_ProjMakFilePath[projectName].Length - stripStart - 4 - projectName.Length;
String projMakFilePath = m_ProjMakFilePath[projectName].Substring(stripStart, stripLength);
When I ran I was getting a negative number in stripLength, which caused Substring to throw an exception. This may be because the proj and sln files are in different directories on my setup. I think the code is trying to get the directory that the project lives in? I changed the code locally to
String projMakFilePath = Path.GetDirectoryName(m_ProjMakFilePath[projectName]);
Which seems to work for me. If that does what you expect maybe you could fold my change into your code?
Cheers,
Amy
|
|
|
|

|
Hi,
I will not insert your changes in my code, since this tool is more article then released tool that can cover all solution structures. Because there are infinite possibilities to it.
This article was born to show how solution for VS 2005 and 2008 looks like and how it can be translated to Linux makefile. I glad that a lot of people may use this tool as is, but someone need some fixes in my original code in aim to adjust to their projects.
Thank you.
Regards,
Maria.
There is nothing impossible.
|
|
|
|

|
Hi Maria,
I need to change the project in VS2008 to Linux.
I have the sln file like this a.sln
In the sln file i have projects like this:
b.vcproj---This is a library
a.vcproj--- This is the main dll and it is dependent on all other Library.
c.vcproj---This is a library
d.vcproj---This is a library
All the above prjts have relative path in the solution file.
I have tried giving
sln2mak -l a.vcproj a.sln
I am able to successfully generate the makefile but it is generating only for the main project(a.vcproj) for rest
of the proj(b.vcproj, c.proj and d.vcproj) in not generating.
Let me know the correct command line for this ?
giving command
sln2mak a.vcproj -d b c d
but it is giving some error for it.
Creating file a.mak...
Unhandled Exception: System.ArgumentException: The path is not of a legal form.
at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck)
at System.IO.Path.GetDirectoryName(String path)
at sln2mak.VcSlnInfo.iPrintTargetRules() in C:\Codes\sln2mak\sln2mak\sln2mak\
VcSlnInfo.cs:line 271
at sln2mak.VcSlnInfo.GenerateMakefile(Boolean parseVcproj) in C:\Codes\sln2ma
k\sln2mak\sln2mak\VcSlnInfo.cs:line 436
at sln2mak.Parser.CreateMakefile(List`1 projectsList, String[] mainProjectDep
endencies) in C:\Codes\sln2mak\sln2mak\sln2mak\Parser.cs:line 92
at sln2mak.Program.Main(String[] args) in C:\Codes\sln2mak\sln2mak\sln2mak\Pr
ogram.cs:line 115
Thanks,
Himanshu.
|
|
|
|

|
Hi,
If your solution has been built like you described, i mean main project has the same name as solution itself and all other libraries are dependencies, so your command line should be like this:
sln2mak a.sln
There is nothing impossible.
|
|
|
|

|
Doing this give me following error:
sln2mak a.sln
Unhandled Exception: System.Collections.Generic.KeyNotFoundException: The given
key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at sln2mak.VcSlnInfo.iPrintDefaultTargetRule()
at sln2mak.VcSlnInfo.GenerateMakefile(Boolean parseVcproj)
at sln2mak.VcSlnInfo.GenerateMakefile()
at sln2mak.Parser.ParseSln(String projName, String slnFName)
at sln2mak.Program.Main(String[] args)
|
|
|
|

|
1)Does sln2mak tool placed within your solution folder?
2)Otherwise, when you call sln2mak a.sln a=full path to your sln?
3)Did you replaced the reference as described here?
If you convert this source code to Visual Studio 2008, please use proper Microsoft.VisualStudio.VCProjectEngine reference version 9.0.0.0 instead of 8.0.0.0.
There is nothing impossible.
|
|
|
|

|
I have put the sln2mak in the sln folder, done the changes of version 9.0.0.0. but same error
This is my a.sln file
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "b", "..\..\www\b.vcproj", "{49984C9E-831C-45D2-97DE-422ED8A41AED}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "a", "..\a.vcproj", "{1572A4FD-07A6-4351-BCFB-48390D0F0B47}"
ProjectSection(ProjectDependencies) = postProject
{49984C9E-831C-45D2-97DE-422ED8A41AED} = {49984C9E-831C-45D2-97DE-422ED8A41AED}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "c", "..\c.vcproj", "{02DCDF92-76AB-43BA-9AC7-B4EE8365C3B5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d", "..\d.vcproj", "{2F427394-483C-407B-A1D9-61A87E03B053}"
EndProject
Global
|
|
|
|

|
please call to the tool with full path to the sln, otherwise relative path to a ("..\a.vcproj") can not be calculated properly.
There is nothing impossible.
|
|
|
|

|
I am calling the tool with full path of sln.
Do i need to put full path for all the projects mentioned in sln?
|
|
|
|

|
No.
There is nothing impossible.
|
|
|
|

|
one more thing i am getting exception(System.Collections.Generic.KeyNotFoundException)at this line:
(d < m_ProjDependencies[m_MainProjectName].Length)
while running like this
sln2mak a.sln
|
|
|
|

|
As i remember, i assumed that the main project always placed in the same folder as .sln. In your case a placed in relative path. Please, try to debug the tool and fix the bug or change your solution to be as assumed.
I hope it will help.
There is nothing impossible.
|
|
|
|

|
I have the main file name as CPa.vcproj rest sln mentioned previously is same
and I am giving :
sln2mak -l CPa "Full_Path\a.sln
and it is genarting the Makefile and a.mak but not generating b.mak , c.mak is this the bug in tool or I am not giving the correct command.
Thanks,
Himanshu.
|
|
|
|

|
the command is right and creation of Makefiel and a.mak is right.
in aim to create b.mak and c.mak they should be dependencies of a within a.vcproj.
There is nothing impossible.
|
|
|
|

|
Hi,
I tried using the tool and I get following issues (on Windows 7, x86, VS 2005).
'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll while executing from sources.
From command line, I get:
Unhandled Exception: System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class f
actory for component with CLSID {FBBF3C66-2428-11D7-8BF6-00B0D03DAA06} failed due to the following error:
80040154.
at sln2mak.VcProjInfo..ctor(String vcProjFile, String outFile, String[] projDependencies) in at sln2mak.Program.Main(String[] args) in ..\sln2mak\sln2mak\Program.cs:line 109
Can you please suggest any solution? The exact format to use command was followed with no dependency.
Regards,
Swapneel.
|
|
|
|

|
Hi,
In aim to suggest you a proper command line, please send me a command line you use and explain how your solution is build.
Regards,
Maria.
There is nothing impossible.
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
232 messages have been posted for this article
Visit http://www.codeproject.com/Articles/28908/Tool-for-Converting-VC-2005-Project-to-Linux-Makef to post and view comments on
this article, or click here
to get a print view with messages.
|
|