Home Help Center

Building for Windows from source without nuget

bold84bold84 Bangkok, ThailandMember Benjamin OldenburgOrganization: ORDIS Co., Ltd.Project: N/A
edited March 7 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

Best Answers

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    edited March 7 Answer ✓

    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

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    edited March 7 Answer ✓

    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>
    

Answers

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff

    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?

  • bold84bold84 Bangkok, ThailandMember Benjamin OldenburgOrganization: ORDIS Co., Ltd.Project: N/A

    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

  • bold84bold84 Bangkok, ThailandMember Benjamin OldenburgOrganization: ORDIS Co., Ltd.Project: N/A

    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.

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    edited March 7 Answer ✓

    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

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    edited March 7 Answer ✓

    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>
    
  • bold84bold84 Bangkok, ThailandMember Benjamin OldenburgOrganization: ORDIS Co., Ltd.Project: N/A

    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

Sign In or Register to comment.