简体   繁体   中英

can't open vs2010 csproj file in vs2012

Goal:

doing xna with winforms.

Way

getting the code and how from their programmer, Microsoft from this link , which contains a solution with three projects in it, the form project, the Content and the ContentLibrary project.

Projects explanation:

The ContentLibrary project builds a dll which the form project references(but it doesn't seem to have anything and I don't know why).
It references the Content project in a bizzare way I have never seen.
The Content project contains a picture file, nothing else and I don't know what does it build.
Finally the form project which contains the main form which have many controls including user defined ones, one abstract which inherits xna control, and others to implement this control(these will do the drawing).

Problem:

could not open the ContentLibrary project.
the error message I get: C:\\Program Files(x86)\\MSBuild\\Microsoft\\XNA Game Studio\\Microsoft.Xna.GameStudio.targets was not found confirm that the path in the declaration is correct and that the file exists on disk

My Try:

opening the ContentLibrary project file(.csproj one) with notepad and here's what I found:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{396ADBE6-FB16-4DBA-8C70-C16A46B448EA}</ProjectGuid>
<ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}     </ProjectTypeGuids>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ContentLibrary</RootNamespace>
<AssemblyName>ContentLibrary</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
<XnaPlatform>Windows</XnaPlatform>
<XnaProfile>Reach</XnaProfile>
<XnaCrossPlatformGroupID>e0c073d9-a61b-474a-bda0-a8ada2c89669</XnaCrossPlatformGroupID>
<XnaOutputType>Library</XnaOutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\x86\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoStdLib>true</NoStdLib>
<UseVSHostingProcess>false</UseVSHostingProcess>
<PlatformTarget>x86</PlatformTarget>
<XnaCompressContent>false</XnaCompressContent>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\x86\Release</OutputPath>
<DefineConstants>TRACE;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoStdLib>true</NoStdLib>
<UseVSHostingProcess>false</UseVSHostingProcess>
<PlatformTarget>x86</PlatformTarget>
<XnaCompressContent>true</XnaCompressContent>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.GamerServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Video, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Avatar, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
  <Private>False</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
  <Private>False</Private>
</Reference>
<Reference Include="mscorlib">
  <Private>False</Private>
</Reference>
<Reference Include="System">
  <Private>False</Private>
</Reference>
<Reference Include="System.Xml">
  <Private>False</Private>
</Reference>
<Reference Include="System.Core">
  <RequiredTargetFramework>4.0</RequiredTargetFramework>
  <Private>False</Private>
</Reference>
<Reference Include="System.Xml.Linq">
  <RequiredTargetFramework>4.0</RequiredTargetFramework>
  <Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Content\Content.contentproj">
  <Project>{618DED89-9BA8-44D7-83A0-163041666FAC}</Project>
  <Name>Content</Name>
  <XnaReferenceType>Content</XnaReferenceType>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
<!--
  To modify your build process, add your task inside one of the targets below and uncomment it. 
  Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
-->
</Project>

Optional information:

in case needed, I'm running Windows 8 x64.

I found a solution here: https://bitbucket.org/rbwhitaker/xna-beyond-vs-2010/downloads

The link given contains a script file which is launched by PowerShell(similar to command prompt). If you run Windows 7 or later you have PowerShell, if not use this link:
http://www.microsoft.com/en-us/download/details.aspx?id=40855

When you're ready follow these steps:

  1. Open PowerShell.
  2. Navigate to where you put the script by using cd command.
  3. Run the following command: Set-ExecutionPolicy Unrestricted . This is because PowerShell doesn't activate script files by default to protect your computer, you can change it back when finished by typing: Set-ExecutionPolicy Restricted
  4. Run the script using this command: .\\XnaFor2013.ps1
  5. Wait, it takes some time, on my computer it took about 15 minutes. It may take longer on slower computers. (I had windows 8 64 bit.)

If you want to know what this script does scroll down to the end of this page:
http://rbwhitaker.wikidot.com/setting-up-xna

Excerpt to prevent link rot:

First, it downloads the XNA installer from Microsoft.

It turns out that the XNA installer is just a self-extracting archive that contains about seven other installers. So the next thing the script does is unpack those "internal" installers.

Six of the seven do exactly what you want them to do, out of the box, so the script runs them each in turn.

The other one is the installer that places files in the right place in Visual Studio. Unfortunately, it's looking for Visual Studio 2010, while you've got a newer version (2012 or 2013 both work with the script). So the script tells this installer to just place the files in a temporary location.

These files are built for Visual Studio 2010 and require some changes, so the script makes the changes and places them in the appropriate place for your version of Visual Studio. (In fact, it does it for all versions of Visual Studio you've got installed, regardless of whether it's 2012 or 2013, and regardless of if it's a paid version or Express for Windows Desktop.)

Unfortunately, Visual Studio doesn't automatically check for new add-ons. (Actually, that's a good thing because it would take too long to check all the time, but in this case, it's bad because we need it to check.) To make it check for new addons, the script deletes the extension cache and has Visual Studio rebuild it. Rebuilding the cache takes most of the time that the script runs for. (Several minutes.)

Once it's rebuilt, everything is ready to go, and the script deletes the temporary files that it created.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM