locked
SDK Package / Template: Project to Project Referencing With A Custom Language User Defined Project RRS feed

  • Question

  • I have created a custom SDK Package with a set of templates based of the following tutorial:

    However instead of creating a ".csproj" I made my own custom type of project modeled after the standard Microsoft "Visual C++ Makefile Project" which allows you to use an external build system. To make this change I have simply changed the content of the project output project file to be more similar to that of a makefile project, referencing those import projects / properties / targets rather than the C# equivalents.

    One of my templates creates a project whose output target is a .NET assembly. If I have a solution which contains such a project as well as another project -say a C# Console Application- I'd like the C# project to be able to reference the custom language project via "project to project referencing". Please note that standard referencing of the output dll works; i.e. if I browse to the output folder for the custom language project and create a reference to the dll directly that way.

    The original error I get is this:

    Original error message

    Searching for this in the usual places only brings up articles that imply I need to implement the interface IVsGetCfgProvider. However as I'm leveraging the MPF and inheriting from it's classes I believe that already am and that this line of inquiry might be a red herring.

    This lead me to suspect the content of my project file, thinking that perhaps I am missing expected properties, tags or something in my project file that is causing the project to not correctly populate the MSBuild OutputGroups. After some tinkering I've managed to progress to the following error:

    Using the following project file:

    <?xml version="1.0" encoding="utf-8"?>
    <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <SchemaVersion>2.0</SchemaVersion>
        <ProjectGuid>{db033a6a-8c6b-4d14-8990-cdbdaa0b05c3}</ProjectGuid>
        <OutputType>Library</OutputType>
        <ConfigurationType>DynamicLibrary</ConfigurationType>
        <Name>testdll00</Name>
        <RootNamespace>testdll00</RootNamespace>
      </PropertyGroup>
      <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
      <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
        <DebugSymbols>true</DebugSymbols>
        <OutputPath>bin\Debug\</OutputPath>
        <ConfigurationType>DynamicLibrary</ConfigurationType>
        <NMakeBuildCommandLine>custom_compiler.exe /t:library /o:"testdll00".dll /x:"testdll00.myproj"</NMakeBuildCommandLine>
        <NMakeReBuildCommandLine>custom_compiler.exe /t:library /o:"testdll00.dll" /x:"testdll00.myproj"</NMakeReBuildCommandLine>
        <NMakeCleanCommandLine>del /q testdll00.dll</NMakeCleanCommandLine>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
        <DebugSymbols>false</DebugSymbols>
        <OutputPath>bin\Release\</OutputPath>
        <ConfigurationType>DynamicLibrary</ConfigurationType>
        <NMakeBuildCommandLine>custom_compiler.exe /t:library /o:"testdll00".dll /x:"testdll00.myproj"</NMakeBuildCommandLine>
        <NMakeReBuildCommandLine>custom_compiler.exe /t:library /o:"testdll00.dll" /x:"testdll00.myproj"</NMakeReBuildCommandLine>
        <NMakeCleanCommandLine>del /q testdll00.dll</NMakeCleanCommandLine>
      </PropertyGroup>
      <PropertyGroup Label="Globals">
        <Keyword>MakeFileProj</Keyword>
      </PropertyGroup>
      <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
      <ItemGroup>
        <Compile Include="main.customlangfile">
          <SubType>Code</SubType>
        </Compile>
      </ItemGroup>
      <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
    </Project>

    Searching for this in the usual places brought me to the following suggestions:

    Which I've tried to no avail. I'm fairly convinced that I just need to get the XML of my project file right and this should work properly... but after trying to hack it manually to get it work for a while I'm getting pretty stumped.

    Anyone know where I'm going wrong? Is it the project XML and if so what am I missing? If it isn't what am I missing from my package code.

    Also note that I see this issue whether I'm debugging the VS Package in the experimental Visual Studio instance or whether I'm testing it as a published package installed on a "real machine".

    Environment Details:

    Windows 7 Enterprise (SP1)

    Microsoft Visual Studio 2010 Professional Version 10.0.40219.1 SP1Rel


    Liam

    Wednesday, April 4, 2012 10:04 AM

Answers

  • For those who are interested, the fix was to add an empty "CreateManifestResourceNames" target to custom project file. So in the case of my example here, the ".myproj" file... The new xml can be seen below:

    <?xml version="1.0" encoding="utf-8"?>
    <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <SchemaVersion>2.0</SchemaVersion>
        <ProjectGuid>{db033a6a-8c6b-4d14-8990-cdbdaa0b05c3}</ProjectGuid>
        <OutputType>Library</OutputType>
        <ConfigurationType>DynamicLibrary</ConfigurationType>
        <Name>testdll00</Name>
        <RootNamespace>testdll00</RootNamespace>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
        <DebugSymbols>true</DebugSymbols>
        <OutputPath>bin\Debug\</OutputPath>
        <ConfigurationType>DynamicLibrary</ConfigurationType>
        <NMakeBuildCommandLine>custom_compiler.exe /t:library /o:"testdll00".dll /x:"testdll00.myproj"</NMakeBuildCommandLine>
        <NMakeReBuildCommandLine>custom_compiler.exe /t:library /o:"testdll00.dll" /x:"testdll00.myproj"</NMakeReBuildCommandLine>
        <NMakeCleanCommandLine>del /q testdll00.dll</NMakeCleanCommandLine>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
        <DebugSymbols>false</DebugSymbols>
        <OutputPath>bin\Release\</OutputPath>
        <ConfigurationType>DynamicLibrary</ConfigurationType>
        <NMakeBuildCommandLine>custom_compiler.exe /t:library /o:"testdll00".dll /x:"testdll00.myproj"</NMakeBuildCommandLine>
        <NMakeReBuildCommandLine>custom_compiler.exe /t:library /o:"testdll00.dll" /x:"testdll00.myproj"</NMakeReBuildCommandLine>
        <NMakeCleanCommandLine>del /q testdll00.dll</NMakeCleanCommandLine>
      </PropertyGroup>
      <PropertyGroup Label="Globals">
        <Keyword>MakeFileProj</Keyword>
      </PropertyGroup>
      <ItemGroup>
        <Compile Include="main.customlangfile">
          <SubType>Code</SubType>
        </Compile>
      </ItemGroup>
      <Target Name="CreateManifestResourceNames" />
      <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
      <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
      <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
    </Project>



    Liam

    • Marked as answer by Liam Flanagan Tuesday, May 22, 2012 12:30 PM
    Tuesday, May 22, 2012 12:30 PM

All replies

  • Hello ,
    Thank you for your question.

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Thank you for your understanding and support.
    Yi


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, April 5, 2012 6:26 AM
  • Hi Liam,

    I'd also guess the issue is likely to be with the underlying project file here. The IronPython integration sample uses MPFProj, and I'm able to successfully at a P2P reference to an IronPython classlib project, so that would be the first place I'd look as well.

    I'd actually need a repro to debug to ascertain why that specific dialog is being displayed. There are just too many places where the underlying code can return an error here.

    But you may be able to use the IronPython as guidance. From the looks of the error itself, it appears you are trying to trying to add an assembly reference, rather than a P2P reference.

    Sincerely,


    Ed Dore

    Friday, April 6, 2012 7:44 PM
  • Hi Ed,

    First of all thank you for your resonse and I'm sorry for my horrific tardiness I've been away for a while.

    Anyway I had already checked out the IronPython integration sample prior to posting but on your reference to it had another dive into it to see if it was implementing something that I was missing but came up short again I'm afraid.

    I can make my integration sample available to you if you'd be willing to use it to produce a repro?

    Thanks,


    Liam


    • Edited by Liam Flanagan Wednesday, April 18, 2012 1:32 PM Removed name from post as it's in my signature
    Wednesday, April 18, 2012 10:24 AM
  • Hi Liam,

    This may take a bit more time than I've got allocated for individual forum posts. If you open a paid support incident with CTS (or via your MSDN subscription), we can probably debug through the repro and find the culprit here. Just note that the issue relates to implementing a custom project type with the Visual Studio SDK, and it'll find it's way to me or someone on my team.

    Alternatively, if you want to email me direct (just remove the "online" portion in the email address in my profile), and I'll take a quick look.

    Thanks,


    Ed Dore

    Thursday, April 19, 2012 12:08 AM
  • I've opened a paid support incident.

    Thanks again,



    Liam

    Monday, April 30, 2012 10:52 AM
  • For those who are interested, the fix was to add an empty "CreateManifestResourceNames" target to custom project file. So in the case of my example here, the ".myproj" file... The new xml can be seen below:

    <?xml version="1.0" encoding="utf-8"?>
    <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <SchemaVersion>2.0</SchemaVersion>
        <ProjectGuid>{db033a6a-8c6b-4d14-8990-cdbdaa0b05c3}</ProjectGuid>
        <OutputType>Library</OutputType>
        <ConfigurationType>DynamicLibrary</ConfigurationType>
        <Name>testdll00</Name>
        <RootNamespace>testdll00</RootNamespace>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
        <DebugSymbols>true</DebugSymbols>
        <OutputPath>bin\Debug\</OutputPath>
        <ConfigurationType>DynamicLibrary</ConfigurationType>
        <NMakeBuildCommandLine>custom_compiler.exe /t:library /o:"testdll00".dll /x:"testdll00.myproj"</NMakeBuildCommandLine>
        <NMakeReBuildCommandLine>custom_compiler.exe /t:library /o:"testdll00.dll" /x:"testdll00.myproj"</NMakeReBuildCommandLine>
        <NMakeCleanCommandLine>del /q testdll00.dll</NMakeCleanCommandLine>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
        <DebugSymbols>false</DebugSymbols>
        <OutputPath>bin\Release\</OutputPath>
        <ConfigurationType>DynamicLibrary</ConfigurationType>
        <NMakeBuildCommandLine>custom_compiler.exe /t:library /o:"testdll00".dll /x:"testdll00.myproj"</NMakeBuildCommandLine>
        <NMakeReBuildCommandLine>custom_compiler.exe /t:library /o:"testdll00.dll" /x:"testdll00.myproj"</NMakeReBuildCommandLine>
        <NMakeCleanCommandLine>del /q testdll00.dll</NMakeCleanCommandLine>
      </PropertyGroup>
      <PropertyGroup Label="Globals">
        <Keyword>MakeFileProj</Keyword>
      </PropertyGroup>
      <ItemGroup>
        <Compile Include="main.customlangfile">
          <SubType>Code</SubType>
        </Compile>
      </ItemGroup>
      <Target Name="CreateManifestResourceNames" />
      <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
      <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
      <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
    </Project>



    Liam

    • Marked as answer by Liam Flanagan Tuesday, May 22, 2012 12:30 PM
    Tuesday, May 22, 2012 12:30 PM