1

I am building a project file for our application that I am going to execute from our build machine. I was wondering if it is possible for me to open the project file and get the same view visual studio gives me of the solution when I open a solution file.

So here is my Contosa.proj file so far.

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)'=='' ">Debug</Configuration>
    <RootNamespace>Contosa</RootNamespace>
    <AssemblyName>Contosa</AssemblyName>
  </PropertyGroup>

  <ItemGroup>
    <Projects Include="C:\Users\localuser\Documents\Perforce\Contosa\Branches\Working23\UI\Desktop\ContosaClient\ContosaClient.csproj" />
  </ItemGroup>

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

  <Target Name="Build">

    <PropertyGroup>
        <Contosa>$(MSBuildProjectDirectory)\UI\Desktop\ContosaClient\ContosaClient.csproj</Contosa>
    </PropertyGroup>



    <MSBuild Projects="$(Contosa)"
                 Properties="Configuration=QA;
                             VisualStudioVersion=12.0;
                             DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\;
                             SolutionDir=$(MSBuildProjectDirectory)\"/>
  </Target>
</Project>

Currently double clicking this file with visual studio as its associated application will open the Contosa.proj for text editing. I would really like it to be possible to associate my Contosa.proj file with visual studio like our Contosa.sln file is. So when developers open it with visual studio they get the same view that you get from the Contosa.sln. I don't understand what parts of a csproj or a sln file make them open as projects or solutions in visual studio.

UPDATE 1

I am looking to do what this user Replace .sln with MSBuild and wrap contained projects into targets did but I want the project file to be able to opened by the user like a solution file. I want the Projects I include to be loaded into the solution explorer.

Community
  • 1
  • 1
Max Young
  • 1,522
  • 1
  • 16
  • 42

1 Answers1

0

When visual studio installs, it configures explorer to launch visual studio when a .csproj is doubleclicked (How can I set a file association from a custom file type to a program). Your windows, and your developers windows, don't know what a .proj is. So rename it .csproj or distribute a .sln which references .proj

Community
  • 1
  • 1
zeromus
  • 1,648
  • 13
  • 14