How to install XNA in Visual Studio 2015 (Preview) - xna

How can I install the templates and the the framework for XNA in Visual Studio 2015?
I found this page here that helps installing the XNA framework in Visual Studio 2013, but they do not offer any downloads for Visual Studio 2015.
I know that XNA is not developed anymore by Microsoft, but it is a really great Framework that I need to use in Future.

XNA 4.0 Refresh Now fully supports Visual Studio 2015.
You can find the download for XNA 4.0 Refresh here: https://mxa.codeplex.com/releases/view/618279
It's a zip which contains a Visual Studio extension and various prerequisites. The prerequisites should be installed first, in the order stated in README.txt:
DirectX
XNA Framework 4.0 Redistribution
XNA Game Studio 4.0 Platform Tools
XNA Game Studio 4.0 Shared

EDIT: This one is obsolete; please see Lee Stott's answer above!
I used the XNA Refresh package that can be downloaded here and did all the steps exactely as for VS 2013. But I edited the .vsix file because it doesn't let you install it in VS 2015. It turns out it is simply a ZIP-File. I fixed the version numbers in extension.vsixmanifest to 14.0.
<Installation InstalledByMsi="false">
<InstallationTarget Version="14.0" Id="Microsoft.VisualStudio.VSWinDesktopExpress" />
<InstallationTarget Version="14.0" Id="Microsoft.VisualStudio.Pro" />
<InstallationTarget Version="14.0" Id="Microsoft.VisualStudio.Premium" />
<InstallationTarget Version="14.0" Id="Microsoft.VisualStudio.Ultimate" />
</Installation>
This lets you install the vsix package in Visual Studio 2015!

Works fine with Visual Studio 2015 :
1- Download the latest version of this package
https://mxa.codeplex.com/releases
2- Unzip the content
3- Follow the readme and install all files except the 'vsix'
3- Open the 'XNA Game Studio 4.0.vsix' with the Windows zip
4- Replace code of the 'extension.vsixmanifest' (opened by text editor) file by the following one. Save it on your desktop.
5- Copy the modified 'extension.vsixmanifest' into 'XNA Game Studio 4.0.vsix'
6- Run the vsix with Visual Studio !
<?xml version="1.0" encoding="utf-8"?>
<Vsix xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010">
<Identifier Id="bcc70cc4-703d-4f8b-98f5-d96bfc71335b">
<Name>XNA Game Studio 4.0</Name>
<Author>Microsoft</Author>
<Version>1.4.12</Version>
<Description xml:space="preserve">XNA Game Studio Package provides game development experiences for Xbox 360, Windows, and Windows Phone.</Description>
<Locale>1033</Locale>
<Icon>Package.ico</Icon>
<InstalledByMsi>false</InstalledByMsi>
<SupportedProducts>
<VisualStudio Version="10.0">
<Edition>Ultimate</Edition>
<Edition>Premium</Edition>
<Edition>Pro</Edition>
<Edition>IntegratedShell</Edition>
</VisualStudio>
<VisualStudio Version="11.0">
<Edition>Ultimate</Edition>
<Edition>Premium</Edition>
<Edition>Pro</Edition>
<Edition>IntegratedShell</Edition>
<Edition>VSLS</Edition>
</VisualStudio>
<VisualStudio Version="12.0">
<Edition>Ultimate</Edition>
<Edition>Premium</Edition>
<Edition>Pro</Edition>
<Edition>IntegratedShell</Edition>
<Edition>VSLS</Edition>
</VisualStudio>
<VisualStudio Version="14.0">
<Edition>Ultimate</Edition>
<Edition>Premium</Edition>
<Edition>Pro</Edition>
<Edition>IntegratedShell</Edition>
<Edition>VSLS</Edition>
</VisualStudio>
</SupportedProducts>
<SupportedFrameworkRuntimeEdition MinVersion="4.0" />
</Identifier>
<References>
<Reference Id="Microsoft.VisualStudio.MPF" MinVersion="10.0">
<Name>Visual Studio MPF</Name>
</Reference>
</References>
<Content>
<VsPackage>XNA Game Studio 4.0.pkgdef</VsPackage>
<VsPackage>Microsoft.Xna.GameStudio.Core.pkgdef</VsPackage>
<VsPackage>Microsoft.Xna.GameStudio.pkgdef</VsPackage>
<VsPackage>Microsoft.Xna.VisualBasic.PropertyPages.pkgdef</VsPackage>
<ItemTemplate>ItemTemplates</ItemTemplate>
<ProjectTemplate>ProjectTemplates</ProjectTemplate>
<Assembly AssemblyName="Microsoft.Xna.GameStudio.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d">Microsoft.Xna.GameStudio.Core.dll</Assembly>
<Assembly AssemblyName="Microsoft.Xna.GameStudio, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d">Microsoft.Xna.GameStudio.dll</Assembly>
<Assembly AssemblyName="Microsoft.Xna.VisualBasic.PropertyPages, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d">Microsoft.Xna.VisualBasic.PropertyPages.dll</Assembly>
</Content>
</Vsix>

Related

Project doesn't compile after upgrading from Visual Studio 2017 to 2019

I can't understand the warnings and errors from Visual Studio 2019. It seems that all the references to the packages of the project are no longer working after the upgrade from Visual Studio 2017.
There are the initial lines of the log when I compile the solution.
1>------ Build started: Project: ClientServerUpload, Configuration: Debug Any CPU ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Text.Encoding.CodePages". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3243: No way to resolve conflict between "System.Text.Encoding.CodePages, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Text.Encoding.CodePages". Choosing "System.Text.Encoding.CodePages, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily.
1> No way to resolve conflict between "FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Choosing "FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily.
1> No way to resolve conflict between "FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Choosing "FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily.
1> Consider app.config remapping of assembly "FSharp.Core, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.4.3.0" [] to Version "4.7.0.0" [\\mypath\packages\FSharp.Core.4.7.0\lib\net45\FSharp.Core.dll] to solve conflict and get rid of warning.
There are many other lines after the above, but anyway I can't see what is going wrong. For example, I pick the first message, about "System.Text.Encoding.CodePages". There a warning saying "Could not locate the assembly" and another about a conflict between Version=4.1.3.0 and a reference with no version. But from where does it look at Version=4.1.3.0? In the pacakge.config there is a line:
<package id="System.Text.Encoding.CodePages" version="4.7.0" targetFramework="net461" />
and if I edit the .proj file I see:
<Reference Include="System.Text.Encoding.CodePages"> <HintPath>..\packages\System.Text.Encoding.CodePages.4.7.0\lib\net461\System.Text.Encoding.CodePages.dll</HintPath>
</Reference>
and the HintPath is indeed there. Similar doubts for all the other messages and errors.
Only another example, why is it searching FSharp.Core, Version=4.4.1.0?
Again I have
<ItemGroup>
<Reference Include="FSharp.Core">
<HintPath>..\packages\FSharp.Core.4.7.0\lib\net45\FSharp.Core.dll</HintPath>
</Reference>
in the proj file and in the packages.config
<package id="FSharp.Core" version="4.7.0" targetFramework="net461" />
All the configurations I'm aware of seem correct to me, and the whole solution was completely fine with Visual Studio 2017. The project was built with WebSharper template, I don't know if/how this is relevant, however I also reinstalled WebSharper VSIX, after upgrading to Visual Studio 2019, and I didn't receive any error.
Aside from deleting and restoring all the packages, looking at the .proj file, cleaning and rebuilding the solution, what other options do I have? At what else should I look? I know I can add remapping to the Web.config, but I don't think it is the solution (not even a workaround). For your info, after many hours I managed to get a release with many (strange) lines of remapping and by manually (!) copying some files (including FSharp.Core) from the packages to the bin folder, that is clearly not an acceptable way to proceed.
I seem to recall something similar when I upgraded an F# project from VS2015 to 2017.
The solution was to update the version of the F# runtime (FSharp.Core.dll) in the project properties.
Looking at the .fsproj for a .NET Core 3.0 F# project: the F# runtime is not actually listed, so must be an implicit dependency: maybe removing it would also work.
Step 0
I've restored an old commit of my project to better describe the original situation and to track all the steps to resolve it.
Before the following 2 operations, I had to nuget upgrade from FSharp.Core 4.6 to 4.7, for a problem specific to WebSharper: the Scripts were not produced.
Step 1
I had to edit the .proj file to delete some reference lines, sort of duplicated.
Here is an example for FSharp.Core, but I did the same for many others (I don't know what exactly originated this problem but removing those lines seems to have done the trick for me)
<Reference Include="FSharp.Core">
<HintPath>..\packages\FSharp.Core.4.7.0\lib\net45\FSharp.Core.dll</HintPath>
</Reference>
<Reference Include="FSharp.Core" />
In the above case I deleted the last line (and all the other similar lines without a version reference under a tag containing the version of the same package)
Step 2
Then I copied and pasted all the <dependentAssembly> from the Visual Studio output to the Web.config. Again I don't understand wht they are many more than the ones needed for Visual Studio 2017, but these 2 operations apparently solved my issue.

G1ANT SDK installation for VS 2019

I cloned the repository at the G1ANT.Robot github page and opened G1ANT.Sdk.sln in VS Studio 2019 CE 16.1.5, Win10 Pro with latest updates. I left the default build properties as "Debug" and "AnyCPU". The following error can't be resolved, as I don't have the required files on my system:
Severity Code Description Project File Line Suppression State
Warning Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.CoreUtility, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. G1ANT.AddonTemplate
There are other errors, all seemingly related to dependencies on an earlier version or versions of VS (some I believe to be v14.0 dependent, some to be v15.0 dependent).
I do have the Microsoft.VisualStudio.CoreUtility available, but the version is 16.0 (i.e. VS 2019). In short, it appears that compilation may require an earlier version of VS than the one I have. Installing such an earlier version is not an option for me.
Thanks,
burque505
Yes, file /G1ANT.Sdk/G1ANT.Sdk/source.extension.vsixmanifest should be changed:
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0,]" />
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[15.0,]" />
<InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="[15.0,]" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.6.1,)" />
</Dependencies>
You can download the correct installation: https://github.com/G1ANT-Robot/G1ANT.Sdk/raw/master/G1ANT.Sdk.vsix
I believe it will help :)

Error message in Xamarin Studio: Multiple references to FSharp.Core.dll are not permitted

When I set up a new F# project in Xamarin Studio with a reference to Suave I get an error.
Here are the steps to reproduce the error message:
Create a new solution in Xamarin Studio 6. Type: Console Project in F#
Add the Suave nuget package: Suave 1.1.2
Open Program.fs and add this line on the top of the file: 'open Suave'
After this the word 'open' is decorated with red squiggles and when I move the mouse pointer over it a little pop up appears with this message:
Error: Multiple references to 'FSharp.Core.dll' are not permitted
Why does this error messages come up and how do I remove it?
What I have noticed is that the installation of the Suave nuget package had also caused the installation of the FSharp.Core nuget pakage. Here is the resulting packages.conf file:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FSharp.Core" version="3.1.2.5" targetFramework="net45" />
<package id="Suave" version="1.1.2" targetFramework="net45" />
</packages>
This happens because the Xamarin's F# project template by default references the local copy of FSharp.Core.
Removing the (duplicated) reference should fix the issue.
I just updated Xamarin Studio to ignore the local copy of FSharp.Core if the project contains a reference to a NuGet version. Should be released in XS 6.1 cycle 8.

TFS Can't Restore NuGet Package

I've got TFS doing some continuous integration builds. Today, it broke for one solution. It seems it can't find AutoMapper. All the other packages can be found just fine.
A couple relevant points:
None of the packages are in source control, we're letting TFS restore them.
We have an internal NuGet feed, but it doesn't seem to be a problem in other solutions, and in this solution we are still getting Entity Framework to restore - just not AutoMapper.
I tried removing and re-adding the NuGet Packages. No luck.
If I use Remote Desktop to connect to the build server and open the project in Visual Studio there, it restores the packages and builds fine.
I can build manually by executing D:\"Program Files"\"Microsoft Team Foundation Server 12.0"\Tools\Nuget.exe restore followed by msbuild MySolutoin.sln
Our TFS server is installed on our D:\ drive.
This is from the TFS Logs:
D:\Program Files\Microsoft Team Foundation Server 12.0\Tools\nuget.exe restore "C:\Builds\1\MyCompany Web\FclQuoteWcfService\src\FclQuoteWcfService.sln" -NonInteractive
Installing 'EntityFramework 6.1.3'.
Installing 'InternalPackage 1.0'.
Successfully installed 'InternalPackage 1.0'.
Successfully installed 'EntityFramework 6.1.3'.
Unable to find version '3.3.1' of package 'AutoMapper'.
C:\Program Files (x86)\MSBuild\12.0\bin\amd64\MSBuild.exe /nologo /noconsolelogger "C:\Builds\1\MyCompany Web\FclQuoteWcfService\src\FclQuoteWcfService.sln" /nr:False /fl /flp:"logfile=C:\Builds\1\MyCompany Web\FclQuoteWcfService\src\FclQuoteWcfService.log;encoding=Unicode;verbosity=normal" /p:SkipInvalidConfigurations=true /m /p:OutDir="C:\Builds\1\MyCompany Web\FclQuoteWcfService\bin\\" /p:VCBuildOverride="C:\Builds\1\MyCompany Web\FclQuoteWcfService\src\FclQuoteWcfService.sln.vsprops" /dl:WorkflowCentralLogger,"D:\Program Files\Microsoft Team Foundation Server 12.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Normal;BuildUri=vstfs:///Build/Build/230;IgnoreDuplicateProjects=False;InformationNodeId=12;TargetsNotLogged=GetNativeManifest,GetCopyToOutputDirectoryItems,GetTargetPath;TFSUrl=http://ctidev2k8:8080/tfs/MyCompany;"*WorkflowForwardingLogger,"D:\Program Files\Microsoft Team Foundation Server 12.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Normal;" /p:BuildId="9aa9f8af-c9b9-4d0a-ba06-7cc959231d8e,vstfs:///Build/Build/230" /p:BuildLabel="FclQuoteWcfService_20150330.2" /p:BuildTimestamp="Mon, 30 Mar 2015 20:40:07 GMT" /p:BuildSourceVersion="LFclQuoteWcfService_20150330.2#$/MyCompany Web" /p:BuildDefinition="FclQuoteWcfService"
Exception Message: MSBuild error 1 has ended this build. You can find more specific information about the cause of this error in above messages. (type BuildProcessTerminateException) Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
I've seen this too. It seems to be triggered as soon as NuGet package restore switches to the internal feed. Once it does this is doesn't switch back to the official nuget.org feed and continues to look for the packages on the internal feed.
Ensure both package sources are added to your NuGet.config file. Also ensure both sources are 'active'.
<configuration>
<packageSources>
<add key="nuget.org"
value="https://www.nuget.org/api/v2/" />
<add key="example.com"
value="http://example.com/feed/nuget/" />
</packageSources>
<activePackageSource>
<add key="All"
value="(Aggregate source)" />
</activePackageSource>
</configuration>
See NuGet configuration file documentation.
Matt's answer put me on the right track but we don't use an internal feed so I had to do some more digging. This answer works, at least, for a project created in Visual Studio 2015 and built by TFS 2015.
In Visual Studio, open the NuGet package manager settings (Tools menu > NuGet Package Manager > Package Manager Settings). Choose "Package Sources" from the options list on the left.
Create the nuget.config file at the root of the solution. This should be the same folder location as your ".sln" solution file. Copy the following into the config file:
<configuration>
<packageSources>
</packageSources>
<activePackageSource>
<add key="All"
value="(Aggregate source)" />
</activePackageSource>
</configuration>
Within the <packageSources> tag, create an <add key="" value="" /> entry for each source listed in the "Package Sources" options window. The key is the name of the source as shown above the URL, and the value is the URL itself. Include those listed in both "Available package sources" and "Machine-wide package sources". I did not create an entry for the local filesystem as it wasn't used in this solution. Based on the screenshot above, the complete config file now contains the following:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org"
value="https://api.nuget.org/v3/index.json" />
<add key="Microsoft and .NET"
value="https://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/" />
</packageSources>
<activePackageSource>
<add key="All"
value="(Aggregate source)" />
</activePackageSource>
</configuration>
After committing the nuget.config file to source control, TFS was able to download all the necessary NuGet packages and successfully build the solution.
In addition to Matt's answer, I'd like to highlight the following well-hidden stuff from the NuGet documentation:
NuGet config files are treated in the following priority order
(closest to the folder nuget.exe runs from wins), for example assuming
the solution directory is c:\a\b\c:
c:\a\b\c\.nuget\nuget.config - This file is only used for solution
level packages, and is not supported in nuget 3.0 - 3.4
c:\a\b\c\nuget.config
c:\a\b\nuget.config
c:\a\nuget.config
c:\nuget.config
User specific config file,
%AppData%\NuGet\nuget.config.
Or the user specified file thru option
-ConfigFile.
This could explain some weird behaviour in specific scenario's where a restore does or does not pick up a configured feed, depending on whether youre restoring with nuget 2.x or 3.x
Edit: and I found yet another reason why packages might not be detected:
I have package "A" with version 1.1.1.0 .
Prior 3.4 this command works well:
nuget install A -version 1.1.1.0
With NuGet 3.4 RC I get:
An error occurred while retrieving package metadata for 'A.1.1.1' from
source 'N'. An error occurred while retrieving package metadata for
'A.1.1.1' from source 'N'. Data at the root level is invalid. Line
1, position 1.
...
The client treats 1.1, 1.1.0, 1.01.0 and 1.1.0.0 as the same version
using SemVer rules. The reason non-normalized versions were special
cased in the past is because for v2 http calls the client would first
send the version string exactly as the user specified it

Missing Microsoft.Build.Tasks.v4.0.dll on visual studio online tfs build

I am trying to build my project with visual studio online.
I am getting the following error.
C:\a\src\.nuget\nuget.targets (71): The task factory "CodeTaskFactory" could not be loaded from the assembly "C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Build.Tasks.v4.0.dll". Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Build.Tasks.v4.0.dll' or one of its dependencies. The system cannot find the file specified.
This is coming from the nuget.targets file in my solution.
<UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<EnvKey ParameterType="System.String" Required="true" />
<EnvValue ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process);
}
catch {
}
]]>
</Code>
</Task>
</UsingTask>
I have updated nuget.exe to latest and have not changed anything in nuget.targets.
The problem was that some of the class libraries in the solution had the default value :
ToolsVersion="12.0"
changing that to
ToolsVersion="4.0"
made it work on TFS online
I ran into this after upgrading a project to .NET 4.5.2. Seems to be a conflict between the .NET 4.5 point releases and the old way to do NuGet package restore (MSBuild-Integrated package restore vs Automatic Package Restore).
I was able to solve the issue by migrating NuGet to the new way of doing package restore: http://docs.nuget.org/consume/package-restore/migrating-to-automatic-package-restore
More info: http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html

Resources