I'm following this tutorial on how to create a new Visual Studio Project type. In there, it says to "Import the source-code files for the Managed Package Framework". Google led me to this link that has a link to MPF 2013 package. In the first link they say to look for a file ProjectBase.files which does not exist in the second link download.
Questions:
Where is the correct MPF download for Visual Studio 2017.
In the future when we move on to Visual Studio 2019, will I need to download a new MPF for 2019?
I had the same problem, but it seems that I alreasy solved it. It seems that MPF is not needed anymore to do these steps and the tutorial is a bit outdated:
How to do it now:
Instead of loading the "Managed Package Framework code", skip this whole step in the tutorial and go to the next chaprer.
In the next chapter skip everything until step 3 and register
this.RegisterProjectFactory(new SimpleProjectFactory(this));
in the InitializeAsync Task of the SimpleProjectPackage.cs
At step 6 implement FlavoredProjectFactory instead of ProjectFactory
Continue the tutorial and it should work fine now.
In the end it should look like this:
class SimpleProjectFactory : FlavoredProjectFactory
{
private SimpleProjectPackage simpleProjectPackage;
public SimpleProjectFactory(SimpleProjectPackage simpleProjectPackage)
{
this.simpleProjectPackage = simpleProjectPackage;
}
protected override object PreCreateForOuter(object outerProject)
{
return null;
}
}
Related
I opened the ".cs" file from Unity after creating a C# file in my project, however
neither UnityEngine nor (obviously) MonoBehaviour is detected in VS Code.Due to this, Intellisense also can't help, which is a major obsticle for me, because I am completely new to the UnityEngine library. The OmniSharp log also gives a
warning in the output:
[fail]: OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: c:\Users\bomka\My project\Assembly-CSharp.csproj
[warn]: OmniSharp.Roslyn.CSharp.Services.InlayHints.InlayHintService
Inlay hints requested for document not in workspace Location { FileName = c:\Users\bomka\My project\Assets\scripts\Circle.cs, Range = Range { Start = Point { Line = 0, Column = 0 }, End = Point { Line = 19, Column = 0 } } }
Things I've tried so far:
I've redownloaded both Unity and VS Code (latest versions, which are 2021.3.3f1 and 1.67.2, respectively)
I checked whether Visual Studio Code Editor and Visual Studio Editor were downloaded in Unity's Package Library (they are, it's 1.2.5 and and 2.0.15, respectively)
I changed omnisharp.path to "latest" in VS Code because I've read it resolved the "Attempted to update project..." issue. It didn't really do anything unfortunately
Does anyone have any ideas concerning what I should do here? Another useful piece of information is that this is my first ever Unity Project and so VS Code didn't just decide to malfunction after a while, this is how it's been behaving since I started writing my first piece of code for my project.
Cheers!
Is VS set in your external tools in Unity?
Edit > Pref > External Tools > External (Script) Editor : Visual Studio..
Not sure if it'll help but I know the above will fix Intellisense issues so it might be worth a shot.
I have a Asp.Net MVC Core website that's using public static async Task Main(). For that to work I've set the language version to C# 7.2 (in the properties -> build -> advanced dialog, double checked in the csproj) for both Debug and Release build configurations.
App builds and starts fine in both Debug and Release mode.
Now, I'm trying to publish it to an Azure Website directly from Visual Studio 2017 15.5.2 (with WebDeploy) and I get this:
Program.cs(17,29): Error CS8107: Feature 'async main' is not available
in C# 7.0. Please use language version 7.1 or greater. CSC(0,0): Error
CS5001: Program does not contain a static 'Main' method suitable for
an entry point
In the output window I see it's running C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\csc.exe with some flags, probably one of them is wrong?
Anyone know if this is a known issue or I'm doing something wrong?
This appears to be a bug in Visual Studio.
Adding this line to main property group in the .csproj file resolved the issue for me:
<LangVersion>latest</LangVersion>
The issue was also reported here in the ASP.NET Home repository.
Not an answer, per se, but for what it's worth async Main is just syntactic sugar. Behind the scenes Roslyn just adds the standard void Main wrapper construction:
static void Main(object[] args)
{
MainAsync(args).GetAwaiter().GetResult();
}
static async Task MainAsync(object[] args)
{
// your code
}
It's probably not worth your time trying to get the server on the same page C# version-wise, just to save literally three lines of code.
Since switching from VS 2013 to VS 2015 and using some new C# 6 features, our daily builds in Visual Studio Online have begun failing.
The errors on the build are all pointing to the new auto property feature but I assume all new features will cause this.
An example piece of code that causes a failure is using:
public int MyFavouriteNumber { get; set; } = 7;
instead of
private int _myFavouriteNumber = 7;
public int MyFavouriteNumber
{
get { return _myFavouriteNumber; }
set { _myFavouriteNumber = value; }
}
I've had a look around my build configuration, but I can't see anything that relates to C# 6 or Roslyn.
What do I have to change to make my daily builds work again?
Edit
Here's an example error (they're all the same, for auto properties).
Models\Core\Bookings\BookingProduct.cs (29, 0)
Invalid token '=' in class, struct, or interface member declaration
Models\Core\Bookings\BookingProduct.cs (29, 0)
Invalid token '(' in class, struct, or interface member declaration
And here is the offending line:
public virtual IList<BookingPricingAddon> AddonsPricing { get; set; } = new List<BookingPricingAddon>();
TheLethalCoder's comments pointed me in the right direction.
The problem was that all of my projects were using Default as the target Language Version, which is fine if you're using VS 2015, however, my .sln file had the following opening 3 lines:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
Apparently, Visual Studio Online uses this to work out which version of MSBuild to use. (It was using 12).
Upgrading my solution to the following:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
allowed Visual Studio Online to see that my IDE was using Roslyn, and therefore used MSBuild 14.
The easiest way I found to upgrade is to click on the solution in Solution Explorer and then going to File > Save As > Solution File and overwrite your existing solution file, it just upgrades the first 3 lines.
My builds are now successful.
I think the same could be achieved by setting the Language Version on each of your projects. This can be done by going to your .csproj files and navigating to:
Properties > Build > Advanced > Language Version > C# 6.0
A good reference about the Default settings in each IDE can be found here.
I read these links on the official Microsoft page Update a customized process template to access new features :
http://blogs.msdn.com/b/visualstudioalm/archive/2012/05/31/how-to-configure-features-for-dozens-of-team-projects.aspx
https://features4tfs.codeplex.com/
When I try to execute Features4tfs.2015 in debug I get this exception
System.NotSupportedException: Specified method is not supported. at Microsoft.TeamFoundation.Integration.Server.CommonStructureService.Microsoft.TeamFoundation.Framework.Server.ITeamFoundationService.ServiceStart(TeamFoundationRequestContext systemRequestContext)
on this call
ProjectFeatureProvisioningService.GetFeatures(...).
Any idea?
It seems to live here in v14:
public class ProjectFeatureProvisioningService : ITeamFoundationService, IProjectFeatureProvisioning
Name: Microsoft.TeamFoundation.Server.WebAccess.WorkItemTracking.Common.ProjectFeatureProvisioningService
Assembly: Microsoft.TeamFoundation.Server.WebAccess.WorkItemTracking.Common, Version=14.0.0.0
Reflector is your friend in these cases. Just load all assemblies from the TFS server directories into Reflector and then use the search feature:
It'll then be a piece of cake to find the assembly "Microsoft.TeamFoundation.Server.WebAccess.WorkItemTracking.Common.dll" here:
C:\Program Files\Microsoft Team Foundation Server 14.0\Application Tier\Web Services\bin
C:\Program Files\Microsoft Team Foundation Server 14.0\Application Tier\TFSJobAgent\Plugins
These internal classes can move between assemblies without notification. That's why they're internal ;).
Full disclosure: I received a copy of Reflector Pro for my blogging and love for the product. There are other products like IlSpy, justDecompile or dotPeek which may offer similar functionality.
Here is a solution proposed by Microsoft to solve the problem with features4tfs on TFS 2015 RTM :
insert this line
deploymentHostProperties.PlugInDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), #"Microsoft Team Foundation Server 14.0\Application Tier\TFSJobAgent\Plugins");
just after this line (line 68)
TeamFoundationServiceHostProperties deploymentHostProperties = new TeamFoundationServiceHostProperties();
After that it works perfectly on TFS 2015 RTM.
Has anyone been able to get an extension up and running Expression Blend + Sketchflow preview? I'm looking for an example project.
I was following this article, but it is a bit outdated.
So far I:
Created a .Net 4.5 class library project
Added a reference to the Microsoft.Expression.Extensibility.dll in the new Blend Preview directory
Set my project to deploy to the appropriate Addins directory
Setup Visual Studio to run the new Blend.exe for debugging
Hooked up MEF and inherited IPlugin as in the example
But my plugin doesn't seem to load and no breakpoints are hit.
After reading your question I decided to start working on a new version of that tutorial.
A few things to get you started right away.
I've created the basic plugin like this:
using System.ComponentModel.Composition;
using Microsoft.Expression.Extensibility;
namespace Demo.Extension
{
[Export(typeof (IPackage))]
public class Demo : IPackage
{
public void Load(IServices services)
{
}
public void Unload()
{
}
}
}
Make sure you:
place the plugins in ...\Blend Preview\extensions
run visual studio as administrator to be able to deploy to that folder during debug
implement the IPackage instead of IPlugin
Got it working by following the demo here.
I used the few modifications above, and put things in the Blend Preview directory.