"Microsoft.Silverlight.CSharp.targets" was not found.


You may get this with Silverlight version 4 projects when trying to open in version 5 if version 4 bits are not on that machine. What has worked for me (after serveral hours of trying everything) is to edit the csproj file and change the silverlight target version

<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
change from 4 to 5

Deploying a web service in silverlight

Typically you will be developing in a local system and then 'pushing' to live. You must 'point' the web service to the live location by right clicking on the Service Reference and then putting the correct address in the box as marked

ws.PNG
System will try and rebuild the 'meta' classes so you must actually be able to access this service address.

you will also need:

1. crossdomain.xml set up
2. clientaccesspolicy.xml set up
3. applicationpool with the right credentials






Inject objects

This is an example of a class that injects itself
public partial class GanttView
    {
        private IGanttModelInt _model;
        /// <summary>
        /// Injected IGanttModel instance.
        /// </summary>
        [Import]
        public IGanttModelInt Model
        {
            get { return _model; }
            set
            {
                if (_model != null) throw new ArgumentNullException("Model");
 
                _model = value;
 
                // inject model into static classes here:
                Helpers.SearchHelper.Model = Helpers.UpdateHelper.Model = _model;
                Converters.TaskBarUtilities.Model = _model;
 
                // inject RadiantQ gantt control into model api property.
                _model.GanttApi = GanttControl;
            }
        }
 
        private MainViewModel _main;
        /// <summary>
        /// Main view model.
        /// </summary>
        [Import]
        public MainViewModel Main
        {
            get { return _main; }
            set
            {
                _main = value;
                this.DataContext = _main;
            }
        }
 
        /// <summary>
        /// Constructor.
        /// </summary>
        public GanttView()
        {
            InitializeComponent();
 
            CompositionInitializer.SatisfyImports(this);
 
            SetUpWorkTimeSchedule();
 
            GanttControl.TemplateApplied += (s, e) =>
            {
                // fixes margin error at column headers:
                GanttControl.GanttTable.CanUserReorderRows = false;
 
                // set the gantt table row and cell styles here:
                GanttControl.GanttTable.RowStyle = Application.Current.Resources["GanttTableRowStyle"] as Style;
                GanttControl.GanttTable.CellStyle = Application.Current.Resources["GanttTableCellStyle"] as Style;
                GanttControl.GanttTable.RowBackground = Application.Current.Resources["RowBackgroundNormal"] as Brush;
                GanttControl.GanttTable.AlternatingRowBackground = Application.Current.Resources["RowBackgroundAlternating"] as Brush;
            };
        }
 
        private void SetUpWorkTimeSchedule()
        {
            _model.GanttApi.RoundTimeEditsTo = RoundToOptions.Day;
 
            _model.GanttApi.ProjectStartDate = new DateTime(2011, 1, 1);
            _model.GanttApi.ProjectEndDate = new DateTime(2012, 1, 1);
 
            (_model as GanttModel).SetWeekWorkingTime(new Collection<Tuple<DayOfWeek, Double, Int32>>
                                                    {
                                                        new Tuple<DayOfWeek, Double, Int32>(
                                                            DayOfWeek.Monday, 0.0, 24),
                                                        new Tuple<DayOfWeek, Double, Int32>(
                                                            DayOfWeek.Tuesday, 0.0, 24),
                                                        new Tuple<DayOfWeek, Double, Int32>(
                                                            DayOfWeek.Wednesday, 0.0, 24),
                                                        new Tuple<DayOfWeek, Double, Int32>(
                                                            DayOfWeek.Thursday, 0.0, 24),
                                                        new Tuple<DayOfWeek, Double, Int32>(
                                                            DayOfWeek.Friday, 0.0, 24)
                                                    });
        }
    }
}
Then retrieve a reference

private IGanttModel _ganttModel;
        /// <summary>
        /// Gantt model interface.
        /// </summary>
        public IGanttModel GanttModel
        {
            get { return _ganttModel; }
            set { SetValue(ref _ganttModel, value, () => GanttModel); }
        }