Archived

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

VS2010 add-in and perforce

I currently have a project that has slice files as links. So the proiject is purely a cspjoj file. i have the proj file under source control. When I sync a new workspace with the project in it the .cs files are not generated. I have to check the files out, edit them, and then double click the missing .cs file in the project to force a regeneration of the .cs files. This seems very cumbersome and does not support automated builds.

What could I be doing wrong? I am sure it is a simple user error on my part I just cannot find the magic switch to make it work.

What I would presume would happen would be that when the project is built the files are first generated if they don't exist and then compiled.

I would appreciate any help in this matter.

ICE version 3.4.1
Add-in version 3.4.1.2
Visual Studio 2010 C# .Net4
Windows 7

Comments

  • xdm
    xdm La Coruña, Spain
    Hi,
    I currently have a project that has slice files as links. So the proiject is purely a cspjoj file.

    Can you clarify that, how you add the files to the project?
    When I sync a new workspace with the project in it the .cs files are not generated
    I m not sure what you mean, with syn a new workspace, is that a VS 2010 feature?
    I have to check the files out, edit them, and then double click the missing .cs file in the project to force a regeneration of the .cs files.
    Double click the files doesn't cause a regeneration, but maybe the icons aren't update by VS at that point.
    What I would presume would happen would be that when the project is built the files are first generated if they don't exist and then compiled.

    The slice compiler is run at several points, first when a project is open all files that aren't update are generated, second when a Slice file is added to project the builder is run and check all files that need to be rebuild, third when a project is build the slice compiler is also run, fourth when Slice files are removed the builder is also run.

    Are you sure that the files aren't generated in you case, it seems to me that could be that just the icon's are reflecting the current state. If the generated files aren't there could you provide steps to reproduce the issue so we could investigate it.

    Jose
  • xdm wrote: »
    Can you clarify that, how you add the files to the project?
    I use add existing item add as link.
    xdm wrote: »
    I m not sure what you mean, with syn a new workspace, is that a VS 2010 feature?
    Synchcronise - get the code from the repository - update my workspace - It is a perforce thing but it applies to all revision control systems. It means to get the latest revision of the files from the code repository. no it is not a VS thing.
    xdm wrote: »
    Double click the files doesn't cause a regeneration, but maybe the icons aren't update by VS at that point.
    After furthur testing that is quite true. If I invoke build on the project the .cs files are indeed created VS does not however recognise them until I double click.

    xdm wrote: »
    The slice compiler is run at several points, first when a project is open all files that aren't update are generated, second when a Slice file is added to project the builder is run and check all files that need to be rebuild, third when a project is build the slice compiler is also run, fourth when Slice files are removed the builder is also run.
    There are not generated when the project is opened, only when build is run.
    xdm wrote: »
    Are you sure that the files aren't generated in you case, it seems to me that could be that just the icon's are reflecting the current state. If the generated files aren't there could you provide steps to reproduce the issue so we could investigate it.

    Jose

    The build does indeed create the files but the icon state is not updated by VS
  • The issue still remains, however that in a clean workspace doing a build solution F6 in VS does not generate the .cs files.

    If I build the project manually SHIFT-F6 they are generated then I can build the rest of the solution.

    Why won't the Build Solution option generate the .cs files?
  • xdm
    xdm La Coruña, Spain
    There are not generated when the project is opened, only when build is run.

    Files should be generated when opened the solution, could you set the tracing level to "Debug" in Ice Configuration and review Visual Studio Output. Slice compiler will trace the exact command it execute here.
    The issue still remains, however that in a clean workspace doing a build solution F6 in VS does not generate the .cs files.

    In my VS 2010 setup F6 does nothing, F7 builds the solution an Slice compiler is run at this point.
    After furthur testing that is quite true. If I invoke build on the project the .cs files are indeed created VS does not however recognise them until I double click.
    We will check if we can force VS to update icons when the generated files has been created.

    If i not missed something your problem is that when you open/build the solution slice files aren't generated, that shouldn't happen, if you continue having these problem, the simple could be to attach a Visual Studio project that allow us to reproduce the issue. We will be happy to look at it

    Jose
  • xdm wrote: »
    Files should be generated when opened the solution, could you set the tracing level to "Debug" in Ice Configuration and review Visual Studio Output. Slice compiler will trace the exact command it execute here.
    OK I will give that a go and report
    xdm wrote: »
    In my VS 2010 setup F6 does nothing, F7 builds the solution an Slice compiler is run at this point.
    I am running VS2010 Professional 10.0.30319.1 using Visual C# 2010 and .Net Framework 4.1.30319 and My install has F6 as the Build and <SHIFT>F6 for building an individual project. the build.png file attached shows the menu item.
    xdm wrote: »
    We will check if we can force VS to update icons when the generated files has been created.
    That would be great. Thanks
    xdm wrote: »
    If i not missed something your problem is that when you open/build the solution slice files aren't generated, that shouldn't happen, if you continue having these problem, the simple could be to attach a Visual Studio project that allow us to reproduce the issue. We will be happy to look at it
    Jose
    I will see what I can do. I will look at the debug first

    James
  • I am obviously doing something wrong.

    I see no debug output in the output window. I have attached a screen-shot of the output window in VS2010. If this is not where your debug goes, where does it go?

    I have also attached a screen-shot of the ICE config window for you to pass comment on. Maybe I have not got things checked that I should or have something checked that I should not.

    I hope it is something simple

    James
  • OK what I see in the debug is
    ------ Slice compilation started at: 8:48 AM Project: RcmsMain ------
    ------ Slice compilation succeeded: Project: RcmsMain ------
    
    Then later
    ------ Build started: Project: IceInterfaces, Configuration: Debug x64 ------
    error CS1504: Source file '...acoustic.cs' could not be opened ('Unspecified error ')
    error CS1504: Source file '...recorder.cs' could not be opened ('Unspecified error ')
    
    The slice files are in the IceInterfaces project not the RcmsMain project (which is the start-up project).
    It seems the slice compiler is run on the RcmsMain project that has no slice files to process and succeeds.
    The slice compiler is not run on the IceInterfaces project where it should be.

    How do I tell the slice compiler to run on the IceInterfaces project?

    When I run the build on the IceInterfaces project directly I get the following
    ------ Slice compilation started at: 8:53 AM Project: RcmsMain ------
    ------ Slice compilation succeeded: Project: RcmsMain ------
    ------ Build started: Project: IceInterfaces, Configuration: Debug x64 ------
      IceInterfaces -> ...IceInterfaces\bin\x64\Debug\IceInterfaces.dll
    ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
    

    Which seems bizarre that the slice compiler is running on RcmsMain when I invoked the build on the individual project.

    I am now totally confused.

    James
  • xdm
    xdm La Coruña, Spain
    Hi James
    The slice files are in the IceInterfaces project not the RcmsMain project (which is the start-up project).
    It seems the slice compiler is run on the RcmsMain project that has no slice files to process and succeeds.
    The slice compiler is not run on the IceInterfaces project where it should be.

    How do I tell the slice compiler to run on the IceInterfaces project?

    You should enable the Ice Configuration in the project "Ice Interfaces" that has the slice files. In "RcmsMain" you can enable the builder if you want to manage Ice references with the add-in.

    Seems to me that Slice compiler is run in "RcmsMain" because there is a dependecy on IceInterfaces from "RcmsMain" this project.

    When you build a solution, the projects are build in order, Visual Studio handle which projects should be build first based on project dependencies.

    When you build a single project, the add-in first build all projects, that are build dependencies of the project, and then continue to build the project.

    Seems to me that in your case "RcmsMain" is a depency for "IceInterfaces", and you also has enabled the Ice add-in in "RcmsMain" project, that is the reason you see the Slice builder being run in "RcmsMain" when you build "IceInterfaces" project.

    So i think that what you should do is,

    1) Enable Ice add-in in "IceInterfaces" project
    2) If RcmsMain is the start-up project and you want to use generated code here, add a reference to "IceInterfaces" in that project, Right click in "References" choose the Projects tab, and check "IceInterfaces" this will also create a dependency on "IceInterfaces", so the build order is setup properly.

    Note that if "IceInterfaces" has currently a dependency on "RcmsMain" you should first remove that dependency, otherwise Visual Studio don't let you add a reference to "IceInterfaces" as this will create a circular dependency.

    I have been doing some test win perforce today, one thing i have noticed is that generated files should not be checked-in, because perforce lock files an the add-in will not be able to update the files, in general isn't a good idea to have generated files checked in.

    I looking at the other issues you posted

    Jose
  • xdm
    xdm La Coruña, Spain
    Looking at the screen shot of your "Ice Configuration" the include path seems to include "..\..\IceInterfaces", and if i not wrong that is your "RcmsMain", that doesn't contain Slice files.

    In general you only need to configure include path for projects that contains Slice files.

    In projects that doesn't contain Slice files, you could also use the add-in to facilitate the task to manage references to Ice assemblies, but in that case only "Ice Home" and "Ice Components" options are relevant.

    Other options are intended to configure the slice compiler, but when there isn't Slice files there isn't a need to configure the Slice compiler.
  • xdm
    xdm La Coruña, Spain

    Build started: Project: IceInterfaces, Configuration: Debug x64
    error CS1504: Source file '...acoustic.cs' could not be opened ('Unspecified error ')
    error CS1504: Source file '...recorder.cs' could not be opened ('Unspecified error ')

    I unsure about that, the error come from C# compiler, seems that the files are locked or missed when C# compiler try to read it. Are this files generated from Slice? If after follow the recommendation in my previous post you still have problems with this we will look at it again, but i think is due to the other configuration issues i have comment on.

    Jose
  • xdm wrote: »
    You should enable the Ice Configuration in the project "Ice Interfaces" that has the slice files. In "RcmsMain" you can enable the builder if you want to manage Ice references with the add-in.
    That is a given. I have it enabled in the IceInterfaces project.
    xdm wrote: »
    Seems to me that Slice compiler is run in "RcmsMain" because there is a dependecy on IceInterfaces from "RcmsMain" this project.
    Yes RmsMain is the application and IceInterfaces is the dependency. IceInterfaces owns the Ice Interfaces. RcmsMain is indirectly dependent on the IceInterfaces. the screenshot shows the dependencies
    xdm wrote: »
    When you build a solution, the projects are build in order, Visual Studio handle which projects should be build first based on project dependencies.

    When you build a single project, the add-in first build all projects, that are build dependencies of the project, and then continue to build the project.
    That is quite correct and well understood.
    xdm wrote: »
    Seems to me that in your case "RcmsMain" is a depency for "IceInterfaces",
    Incorrect it is the other way round
    xdm wrote: »
    and you also has enabled the Ice add-in in "RcmsMain" project, that is the reason you see the Slice builder being run in "RcmsMain" when you build "IceInterfaces" project.
    OK I will disable the Ice Add-in for RcmsMain even though it is not a dependency of the IceInterface
    xdm wrote: »
    So i think that what you should do is,

    1) Enable Ice add-in in "IceInterfaces" project
    already enabled
    xdm wrote: »
    2) If RcmsMain is the start-up project and you want to use generated code here, add a reference to "IceInterfaces" in that project, Right click in "References" choose the Projects tab, and check "IceInterfaces" this will also create a dependency on "IceInterfaces", so the build order is setup properly.
    already there. See screenshot
    xdm wrote: »
    Note that if "IceInterfaces" has currently a dependency on "RcmsMain" you should first remove that dependency, otherwise Visual Studio don't let you add a reference to "IceInterfaces" as this will create a circular dependency.
    There is no dependency in that direction see screenshot
    xdm wrote: »
    I have been doing some test win perforce today, one thing i have noticed is that generated files should not be checked-in, because perforce lock files an the add-in will not be able to update the files, in general isn't a good idea to have generated files checked in.
    That is a given. They are not checked in, that would be foolish as they are generated files.
  • xdm wrote: »
    Looking at the screen shot of your "Ice Configuration" the include path seems to include "..\..\IceInterfaces", and if i not wrong that is your "RcmsMain", that doesn't contain Slice files.
    You are wrong, ..\..\IceInterfaces is the project that includes the slice files as links. RcmsMain is the start-up project that is dependent on the IceInterfaces.
    xdm wrote: »
    In general you only need to configure include path for projects that contains Slice files.
    I believe that is what I have done.
    xdm wrote: »
    In projects that doesn't contain Slice files, you could also use the add-in to facilitate the task to manage references to Ice assemblies, but in that case only "Ice Home" and "Ice Components" options are relevant.

    OK I will verify and then post screen shots of the two configurations. It has, however seemed in the past that when I select Ice Configuration from the context menu for the IceInterfaces projcect, The changes get made to the RcmsMain project instead, but I will verify this behaviour.
    xdm wrote: »
    Other options are intended to configure the slice compiler, but when there isn't Slice files there isn't a need to configure the Slice compiler.
    Fair enough.
  • xdm wrote: »
    I unsure about that, the error come from C# compiler, seems that the files are locked or missed when C# compiler try to read it. Are this files generated from Slice? If after follow the recommendation in my previous post you still have problems with this we will look at it again, but i think is due to the other configuration issues i have comment on.

    Jose
    Yes this is simply saying that the .cs files have not been generated by the slice compiler and the C# compiler cannot find them. I included it for completeness.
  • xdm
    xdm La Coruña, Spain
    Quote:
    Originally Posted by xdm View Post
    In general you only need to configure include path for projects that contains Slice files.
    I believe that is what I have done.

    But the Configuration dialog you attached, is for RcmsMain not for IceInterfaces, see the title in the configuration dialog you attached "Project: RcmsMain"
  • xdm wrote: »
    But the Configuration dialog you attached, is for RcmsMain not for IceInterfaces, see the title in the configuration dialog you attached "Project: RcmsMain"

    Yes it is. I use the Solution Navigator add-in for VS2010 and it has different behavior to the Solution Explorer that is default with VS2010. When i right click on the IceInterfaces project I get the config dialog for the RcmsMain project. Go figure...

    Having said that Using 'Solution Explorer' the 'Ice Configuration' item is greyed out for the IceInterfaces project (and all non-start-up projects).
    How do I get it enabled so I can configure the IceInterfaces project?
  • I think I am getting an inkling into the issue.

    It seems that the RcmsMain project tries to invoke the Ice Compiler on the IceInterfaces directory (..\..\IceInterfaces), but this directory has no slice files in it because they are links to files in other locations in the IceInterfaces csproj file. As far as RcmsMain is concerned it has done the right thing.

    Before you ask, No we cannot have the ice files in the project as non-links as the ice files are shared between a C++ linux build and a C# windows build.

    The IceInterfaces project has no Ice compiler options enable because the item is greyed out and I cannot access them. maybe if I can enable the Ice Compiler on the IceInterfaces project and remove them from the RcmsMain project all will work well.
  • xdm
    xdm La Coruña, Spain
    I use the Solution Navigator add-in for VS2010
    Ok, we have not tested Solution Navigation add-in, i will give i a try.
    Having said that Using 'Solution Explorer' the 'Ice Configuration' item is greyed out for the IceInterfaces project (and all non-start-up projects).
    How do I get it enabled so I can configure the IceInterfaces project?

    It should be enabled, for C#, C++ projects, note the that 'Ice Configuration' is temporally disabled when the project is build, but is enabled again after the build ends, it should not be any difference in that the project is an startup project or not.
  • xdm wrote: »
    It should be enabled, for C#, C++ projects, note the that 'Ice Configuration' is temporally disabled when the project is build, but is enabled again after the build ends, it should not be any difference in that the project is an startup project or not.

    Maybe it SHOULD be but it is NOT. What would cause it to be not enabled?
  • this is what is in my csproj file for the IceInterfaces project
      <ItemGroup>
        <None Include="..\..\..\ice\genasor\recorder.ice">
          <Link>recorder.ice</Link>
        </None>
        <None Include="..\..\..\ice\saars\acoustic.ice">
          <Link>acoustic.ice</Link>
        </None>
      </ItemGroup>
      <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
      <ProjectExtensions>
        <VisualStudio>
          <UserProperties ZerocIce_Prefix="False" ZerocIce_ExtraOptions="--underscore" ZerocIce_IncludePath="." ZerocIce_Enabled="True" ZerocIce_VerboseLevel="0" />
        </VisualStudio>
      </ProjectExtensions>
    
  • xdm
    xdm La Coruña, Spain
    I think I am getting an inkling into the issue.

    It seems that the RcmsMain project tries to invoke the Ice Compiler on the IceInterfaces directory (..\..\IceInterfaces), but this directory has no slice files in it because they are links to files in other locations in the IceInterfaces csproj file. As far as RcmsMain is concerned it has done the right thing.

    Before you ask, No we cannot have the ice files in the project as non-links as the ice files are shared between a C++ linux build and a C# windows build.
    I doubt the RcmsMain try to run the compiler if there aren't Slice files (links or not) in this project, that is what i see in the Slice compiler output you posted before, and what should happen, if Slice compiler run when there aren't Slice files in the project is a bug and i will appreciate if you can send as a test case so we could fix the issue.

    You can have Slice files as links in RcmsMain, and configure the builder in that project, that should work.
  • xdm
    xdm La Coruña, Spain
    Maybe it SHOULD be but it is NOT. What would cause it to be not enabled?
    One thing that could cause this is that the add-in fails to get the selected project.

    Could you disable the Solution Navigation add-in and check again to see if that works.
  • xdm
    xdm La Coruña, Spain
    Actually will be good if you can attach a demo project, i will look at it, if you don't want to attach it here you can send i to support@zeroc.com

    Jose
  • xdm wrote: »
    Actually will be good if you can attach a demo project, i will look at it, if you don't want to attach it here you can send i to support@zeroc.com

    Jose

    OK I will see if I can cut down our full project to one which will demo the fault and can be sent.
  • Attached is a project that does not work.
    • I have not configured the Slice compiler in the IceAddinTest mainline.
    • I am unable to configure the Slice compiler for the IceInterfaces project

    I will now modify it to have the slice compiling in the IceAddInTest project as per out current system
  • attached is the second project that has the slice comiler configured in the IceAddInTest project and it behaves the same as described prteviously.

    If you delete the recorder.cs file from underneath VS2010 (using windows explorer) then try to build the solution it fails because the Recorder.cs file does not exist.

    If you build the IceInterface project first then build the solution the file is then generated and all is well.

    I hope these help
  • xdm
    xdm La Coruña, Spain
    Hi James

    I have looked at your demos, and i can reproduce your problem, i debugging the issue , meanwhile if you move "IceIterfaces" project out of "ice" folder in solution explorer, you will be able to access "Ice Configuration" for this project and the build will work fine.
  • xdm
    xdm La Coruña, Spain
    Hi James,

    I have review your projects, and found the issues, the add-in currently don't work with projects that are inside a solution folder, you need to move the projects out of the solution folder. The issue will be fixed with the next add-in release.

    I have also looked at the "Solution Navigator" add-in, the problem here is that Ice Add-In, gets the selected project from "Solution Explorer", i cannot promise a fix for that in the next release, but i will try to fix it.

    Thanks for report the problems

    Regards,
    Jose
  • xdm wrote: »
    Hi James

    I have looked at your demos, and i can reproduce your problem, i debugging the issue , meanwhile if you move "IceIterfaces" project out of "ice" folder in solution explorer, you will be able to access "Ice Configuration" for this project and the build will work fine.

    Thankyou for your help on this issue.
    I will move it out of the folder for now as a work-around.
    What is the ETA for the next release of the add-in?
  • bernard
    bernard Jupiter, FL
    Hi James,

    We don't know yet when we'll make another release of the VS add-in; the latest update was released about 3 weeks ago, so a new release is not imminent.

    Best regards,
    Bernard