Make the Visual Studio 2015 build easier #91

Closed
opened 2026-01-29 15:09:09 +00:00 by claunia · 2 comments
Owner

Originally created by @darkstar on GitHub (Aug 30, 2016).

First, on opening the solution file, it complains about an unsupported "Packages.mdproj" file (googling suggests that this is a file from IBM's Rational XDE, whatever that means?). But that can be ignored. I don't know if it breaks anything though...

Then, when building the solution, you will get the error

CSC : error CS0006: Metadata file 'd:\Devel\git\DiscImageChef\commandline\src\CommandLine\bin\Debug\CommandLine.dll' could not be found

which, according to Google, means that some subproject did not get built correctly. Which is most probably related to this error a few lines before:

4>------ Build started: Project: CommandLine, Configuration: Debug Any CPU ------
4>  'mono' is not recognized as an internal or external command,
4>  operable program or batch file.
4>d:\Devel\git\DiscImageChef\commandline\src\CommandLine\CommandLine.csproj(156,5): error MSB3073: The command "mono ..\..\.paket/paket.bootstrapper.exe" exited with code 9009.

which, of course, means that mono cannot be found in Windows' %PATH% (which makes sense).

I ended up editing the *.csproj file for the CommandLine submodule to remove the "mono" part:

d:\Devel\git\DiscImageChef\commandline>git diff
diff --git a/src/CommandLine/CommandLine.csproj b/src/CommandLine/CommandLine.csproj
index 21b935f..62a4076 100644
--- a/src/CommandLine/CommandLine.csproj
+++ b/src/CommandLine/CommandLine.csproj
@@ -153,10 +153,10 @@
   <Target Name="BeforeBuild" DependsOnTargets="PaketInstall">
   </Target>
   <Target Name="BootstrapPaket" Condition="!Exists('..\..\.paket/paket.bootstrapper.exe)')">
-    <Exec Command="mono ..\..\.paket/paket.bootstrapper.exe" />
+    <Exec Command="..\..\.paket\paket.bootstrapper.exe" />
   </Target>
   <Target Name="PaketInstall" DependsOnTargets="BootstrapPaket" Condition="!Exists('$(SolutionDir)paket-files')">
-    <Exec Command="mono ..\..\.paket/paket.exe install" />
+    <Exec Command="..\..\.paket\paket.exe install" />
   </Target>
   <Choose>
     <When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v3.0' Or $(TargetFrameworkVersion) == 'v3.5')">
@@ -223,4 +223,4 @@
       </ItemGroup>
     </When>
   </Choose>
-</Project>
\ No newline at end of file
+</Project>

...which made the build take ages to print any output (2 minutes?) and then, even though it printed multiple errors related to F#, the build succeeded.

Since the "mono" prefix and the forward slashes are probably required on Linux, the above diff cannot be applied as-is without breaking the Linux build. But maybe there is a way to "#ifdef" that part so that on Windows it just runs the "paket.exe" while on Linux it runs /usr/bin/mono

Add to that the fact that there's an actual EXE file in the source repository which gets run on every build and which could do whatever it wants on my PC. Maybe this can be removed entirely, since it seems to only download the CommandLine parser module, which is already a git submodule and as such should be available to the build system without any additional downloads, right? I admit I am very new to all this package-manager stuff, and now I have a 300 megabyte CommandLine parser module for a small 10mb project like DiscImageChef. Welcome to the new world of programming, I guess ;-)

Originally created by @darkstar on GitHub (Aug 30, 2016). First, on opening the solution file, it complains about an unsupported "Packages.mdproj" file (googling suggests that this is a file from IBM's Rational XDE, whatever that means?). But that can be ignored. I don't know if it breaks anything though... Then, when building the solution, you will get the error ``` CSC : error CS0006: Metadata file 'd:\Devel\git\DiscImageChef\commandline\src\CommandLine\bin\Debug\CommandLine.dll' could not be found ``` which, according to Google, means that some subproject did not get built correctly. Which is most probably related to this error a few lines before: ``` 4>------ Build started: Project: CommandLine, Configuration: Debug Any CPU ------ 4> 'mono' is not recognized as an internal or external command, 4> operable program or batch file. 4>d:\Devel\git\DiscImageChef\commandline\src\CommandLine\CommandLine.csproj(156,5): error MSB3073: The command "mono ..\..\.paket/paket.bootstrapper.exe" exited with code 9009. ``` which, of course, means that mono cannot be found in Windows' %PATH% (which makes sense). I ended up editing the *.csproj file for the CommandLine submodule to remove the "mono" part: ``` d:\Devel\git\DiscImageChef\commandline>git diff diff --git a/src/CommandLine/CommandLine.csproj b/src/CommandLine/CommandLine.csproj index 21b935f..62a4076 100644 --- a/src/CommandLine/CommandLine.csproj +++ b/src/CommandLine/CommandLine.csproj @@ -153,10 +153,10 @@ <Target Name="BeforeBuild" DependsOnTargets="PaketInstall"> </Target> <Target Name="BootstrapPaket" Condition="!Exists('..\..\.paket/paket.bootstrapper.exe)')"> - <Exec Command="mono ..\..\.paket/paket.bootstrapper.exe" /> + <Exec Command="..\..\.paket\paket.bootstrapper.exe" /> </Target> <Target Name="PaketInstall" DependsOnTargets="BootstrapPaket" Condition="!Exists('$(SolutionDir)paket-files')"> - <Exec Command="mono ..\..\.paket/paket.exe install" /> + <Exec Command="..\..\.paket\paket.exe install" /> </Target> <Choose> <When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v3.0' Or $(TargetFrameworkVersion) == 'v3.5')"> @@ -223,4 +223,4 @@ </ItemGroup> </When> </Choose> -</Project> \ No newline at end of file +</Project> ``` ...which made the build take _ages_ to print any output (2 minutes?) and then, even though it printed multiple errors related to F#, the build succeeded. Since the "mono" prefix and the forward slashes are probably required on Linux, the above diff cannot be applied as-is without breaking the Linux build. But maybe there is a way to "#ifdef" that part so that on Windows it just runs the "paket.exe" while on Linux it runs /usr/bin/mono Add to that the fact that there's an actual EXE file in the source repository which gets run on every build and which could do whatever it wants on my PC. Maybe this can be removed entirely, since it seems to only download the CommandLine parser module, which is already a git submodule and as such should be available to the build system without any additional downloads, right? I admit I am very new to all this package-manager stuff, and now I have a 300 megabyte CommandLine parser module for a small 10mb project like DiscImageChef. Welcome to the new world of programming, I guess ;-)
Author
Owner

@claunia commented on GitHub (Sep 2, 2016):

The Packages.mdproj thing, is an archaic include in the solution, that was supposed to create optimized packages with source and binaries for different architectures. Something from monodevelop. It only works 1 of each 100 runs without even giving errors so I'll remove it.

The rest of the issues come all from the following scalation:
1.- CommandLine changes API
2.- I adapt DIC to new API
3.- New API does not support enough different verbs so I modify CommandLine to fit my needs
4.- CommandLine upstream tell me they have yet another API that supports as many verbs as I need and more
5.- I'm too busy to change the code again, so I just leave the fork there until next release.
6.- They have a call to the .exe as-is, that does only work on Windows, I add mono, adds support for non-Windows while breaking Windows compilation 😄

The solution, is indeed, easy:
Just remove CommandLine submodule and reference stable DLL (they have a package in NuGet, can be added in VS2015) in DiscImageChef project and change code in Main.cs to use new parsing API.

Then it will happily compile in VS2015.

So if you can do it, please, I can keep closing TODOs 😃

@claunia commented on GitHub (Sep 2, 2016): The Packages.mdproj thing, is an archaic include in the solution, that was supposed to create optimized packages with source and binaries for different architectures. Something from monodevelop. It only works 1 of each 100 runs without even giving errors so I'll remove it. The rest of the issues come all from the following scalation: 1.- CommandLine changes API 2.- I adapt DIC to new API 3.- New API does not support enough different verbs so I modify CommandLine to fit my needs 4.- CommandLine upstream tell me they have yet another API that supports as many verbs as I need and more 5.- I'm too busy to change the code again, so I just leave the fork there until next release. 6.- They have a call to the .exe as-is, that does only work on Windows, I add mono, adds support for non-Windows while breaking Windows compilation 😄 The solution, is indeed, easy: Just remove CommandLine submodule and reference stable DLL (they have a package in NuGet, can be added in VS2015) in DiscImageChef project and change code in Main.cs to use new parsing API. Then it will happily compile in VS2015. So if you can do it, please, I can keep closing TODOs 😃
Author
Owner

@claunia commented on GitHub (May 16, 2017):

Solved in 4c75839198

@claunia commented on GitHub (May 16, 2017): Solved in 4c75839198f5093bd67d126b86202881e6c7b0d7
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: aaru-dps/Aaru-aaru-dps#91