从其他类库项目引用dll的MS构建解决方案。

时间:2016-08-04 07:31:32

标签: visual-studio jenkins msbuild

我正在使用Jenkins进行CI。

我的应用程序 - (解决方案名称HP_app)是一个vb.net windows窗体(存储库https://XXXXXX.org/scm/HP/HP_app.git

Windows表单类库中的引用.dll(解决方案名称HP_app_lib)(存储库https://XXXXXX.org/scm/HP/HP_app_lib.git

我为每个解决方案设置了两个单独的Jenkins作业。类库解决方案构建完美。现在Windows窗体解决方案依赖于HP_app_lib.dll。

<SpecificVersion>False</SpecificVersion>
      <HintPath>..\HP_app_lib\bin\Debug\HP_app_lib.dll</HintPath>
    </Reference>

如何使用msbuild构建Windows窗体。

2 个答案:

答案 0 :(得分:0)

@ user2211290 windows表单项目和汇编文件结构应如下所示: HP_app_lib

- 仓

private GoogleMap mMap;      


@Override
protected void onCreate(Bundle savedInstanceState) {


    try {
        super.onCreate(savedInstanceState);
        int checkGooglePlayServices = GooglePlayServicesUtil
                .isGooglePlayServicesAvailable(getApplicationContext());

        if (checkGooglePlayServices != ConnectionResult.SUCCESS) {

            if (GooglePlayServicesUtil.isUserRecoverableError(checkGooglePlayServices)) {
                GooglePlayServicesUtil.getErrorDialog(checkGooglePlayServices,
                        this,
                        0).show();


            } else
                Toast.makeText(this,
                        "Please check your Google Play Services in order to run this app",
                        Toast.LENGTH_LONG).show();
            finish();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    setContentView(R.layout.activity_gmap);

    setUpMapIfNeeded();


}




@Override
protected void onResume() {
    super.onResume();
    setUpMapIfNeeded();
}

private void setUpMapIfNeeded() {
    // Do a null check to confirm that we have not already instantiated the
    // map.
    if (mMap == null) {
        // Try to obtain the map from the SupportMapFragment.
        mMap = ((SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map)).getMap();

        ((SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map)).setRetainInstance(true);
        // Check if we were successful in obtaining the map.

        if (mMap != null) {
            mMap.setInfoWindowAdapter(new InfoWindowAdapter() {
                @Override
                public View getInfoWindow(Marker arg0) {
                    return null;
                }

                @Override
                public View getInfoContents(Marker marker) {
                    View customMarkerView = null;
                    try {
                        customMarkerView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.view_custom_marker, null);
                        TextView titleView = (TextView) customMarkerView.findViewById(R.id.title);

                        customMarkerView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
                        customMarkerView.layout(0, 0, customMarkerView.getMeasuredWidth(), customMarkerView.getMeasuredHeight());
                        customMarkerView.buildDrawingCache();


                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    return customMarkerView;
                }
            });
            setUpMap();
        }
    }
}


private void setUpMap() {
    try {
        int ZoomLevel = 9;
        int animateZoomLevel = 7;
        double lat = Double.parseDouble(myvehicleInfo.getLatitude());
        double log = Double.parseDouble(myvehicleInfo.getLongitude());
        mMap.addMarker(new MarkerOptions().position(new LatLng(lat, log)));

        String type = Utility.getDefaultMap(GMapActivity.this);
        switch (type) {
            case "Normal":
                mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
                break;
            case "Hybrid":
                mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
                break;
            case "Satellite":
                mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
                break;
            case "Terrain":
                mMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
                break;
        }


        LatLng longlat = new LatLng(lat, log);

        LatLngBounds.Builder builder = new LatLngBounds.Builder();
        builder.include(longlat);



        final CameraPosition cameraPosition1 = new CameraPosition.Builder()
                .target(longlat)
                .zoom(ZoomLevel + animateZoomLevel)
                .tilt(45)
                .build();

        mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(longlat, ZoomLevel));

        try {
            mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition1)
                    , 2500,
                    new GoogleMap.CancelableCallback() {
                        @Override
                        public void onFinish() {
                            double lat = Double.parseDouble(myvehicleInfo.getLatitude());
                            double log = Double.parseDouble(myvehicleInfo.getLongitude());
                            LatLng ll = new LatLng(lat, log);
                            MarkerOptions axesTrackMarker = null;

                            if (myvehicleInfo.getLocation().isEmpty()) {
                                axesTrackMarker = new MarkerOptions()
                                        .position(ll)
                                        .title(myvehicleInfo.getVehicleName());
                            } else {
                                axesTrackMarker = new MarkerOptions()
                                        .position(ll)/*
                                        .icon(BitmapDescriptorFactory
                                                .fromBitmap(
                                                        getMarkerBitmapFromView(
                                                                myvehicleInfo.getVehicleName(),
                                                                myvehicleInfo.getLocation())
                                                        ))*/;


                            }

                            mMap.addMarker(axesTrackMarker).showInfoWindow();
                        }

                        @Override
                        public void onCancel() {
                            // do something
                        }
                    }
            );

        } catch (Exception ex) {
            ex.printStackTrace();
        }
        // }
        //});
    } catch (Exception e) {

    }
}

[windows form project folder(例如HP_app)]

- [windows form project name] .vbproj

之后,直接通过msbuild构建windows表单项目,例如:MSBuild [windows form project name] .vbproj。

答案 1 :(得分:0)

我找到了解决方案。 由于Windows表单解决方案是引用类  图书馆 - 独自独立的VS解决方案也在不断变化。

Below project reference in MSBuild file is changed from 
     <HintPath>..\HP_app_lib\bin\Debug\HP_app_lib.dll</HintPath>

To file path in Jenkins server <HintPath>C:\jenkins\workspace\CI_FASET_LIB\bin\Debug\FASETLib.dll</HintPath>

更多提示。 通常构建服务器不会安装Visual Studio.Jenkins MS build正在C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5中搜索Microsoft.office.Interop.word.dll和ADODB.dll。

所以我已将这些dll从dev机器移动到Build server .net框架路径。

开发机器,因为我们得到了VS,它们位于。

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Visual Studio Tools for Office\PIA\Office14