Archived

This forum has been archived. Please start a new discussion on GitHub.

Building for Windows from source without nuget

bold84
bold84 Bangkok, Thailand
edited March 2022 in Help Center

Hello,

is there a trivial way to build Windows binaries without Visual Studio downloading (restoring) packages? My goal is to build and link Ice against existing libraries. I am aware of the modified mcpp dependency.

Thanks in advance and

kind regards,

Ben

Comments

  • xdm
    xdm La Coruña, Spain

    is there a trivial way to build Windows binaries without Visual Studio downloading (restoring) packages?

    No there isn't

    My goal is to build and link Ice against existing libraries. I am aware of the modified mcpp dependency.

    What are you trying to archive, link with different version of the third-party dependencies?

  • bold84
    bold84 Bangkok, Thailand

    Hello,

    is there a trivial way to build Windows binaries without Visual Studio downloading (restoring) packages? My goal is to build and link Ice against existing libraries. I am aware of the modified mcpp dependency.

    Thanks in advance and

    kind regards,

    Ben

  • bold84
    bold84 Bangkok, Thailand

    Thank you for your reply!

    I have some of the dependencies already built in my project. Or long story short, I wrote a portfile for vcpkg. Works nicely on Mac. But for Windows i need to get rid of the nuget stuff. I guess I’ll have to write a script that removes it from the Ice project files then.

  • xdm
    xdm La Coruña, Spain
    edited March 2022

    I think you will have to at least remove or add a condition to the EnsureNuGetPackageBuildImports targets, so that they are skip with your build.

    https://github.com/zeroc-ice/ice/blob/b962f8f5ea4e3e388595adfa7499d16ea92df6f0/cpp/src/slice2cs/msbuild/slice2cs.vcxproj#L143

    You also need to remove the NuGetRestore dependency on the build targets https://github.com/zeroc-ice/ice/blob/b962f8f5ea4e3e388595adfa7499d16ea92df6f0/cpp/msbuild/ice.proj#L244

    It wouldn't be too complicated to add a MSBuild property to support both vcpkg and NuGet builds

  • xdm
    xdm La Coruña, Spain
    edited March 2022

    For example patch the EnsureNuGetPackageBuildImports targets with a condition like

    <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild" Condition="'$(UseVcpkg)' != 'yes'">
    

    Add separate Build targets that don't depend on NuGetRestore in ice.proj

    <!-- Build with vcpkg -->
    <Target Name="BuildDistWitVcpkg" Condition="'$(ICE_BIN_DIST)' != 'all'">
        <MSBuild Projects="@(DistSolution)"
                    BuildInParallel="true"
                    Properties="%(Properties);UseVcpkg=yes"/>
    </Target>
    
  • bold84
    bold84 Bangkok, Thailand

    Oh, that looks like a much more elegant solution! :-) I will go with that and create a PR, in case you’re interested.

    Thank you very much!

    Ben