Synchronizing configuration between versions of visual studio - c#

I have coworkers, who work on Visual Studio 2015, I have VS2019 and we share code through TFS.
When I make some changes everything works, but when I push code to server my coworkers cannot build the project because they have errors resulting from the fact that VS allows me new C# functionalities like internal functions, inline declarations etc. Is there a way to configure my VS so that it only lets me do the things it allows them to do? I honestly don't have any point where I can start looking into this topic.

You can choose the language version, it may solve some of your issues
I believe 20127 will be locked at C# 7.3, as shown here C Sharp (programming language)
To choose the C# language version for your projects, in the Solution Explorer
right-click on the project and select Properties
Select Build Tab
Then Select Advanced button.
This will bring up the Advanced Build Settings windows, where you can check the drop-down option for “Language Version” of your choice
Usually, you would set this to latest major or minor, though you your case you would likely choose C# 7 - 7.3, which would be compatible with 2017.
Image is for illustrative purpose only
Very relevant comments by JonasH
The langversion will be saved in the csproj file, so it should be
sufficient if it is done once. Also, the language selection dropdown
is disabled in the latest version of vs2019, but you may still edit
the csproj by hand to add it.

Related

Visual studio installer project multi language support

I have a c# WPF application which is able to switch in deferent language as per customer wants. I also created a setup project for the same. I need to make the setup project also be able to switch language.
The problem is, the 'Visual studio installer project' doesn't have an option to do that. There is an option to set language for MSI. However dynamically changing the language is not supported
I have already googled it and no solution found.
some of the similar posts links are below. which also have no correct answer
c# Setup Project Localization
How to create preview choosing setup language in Visual Studio Project Installer?
Any idea how to do that. Thanks in advance
I don't have much experience regarding this, but:
The Wix installer seems to have support for localization:
https://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/
VDProject seems to be the right way to move forward aswell:
https://devblogs.microsoft.com/buckh/visual-studio-setup-projects-vdproj-will-not-ship-with-future-versions-of-vs/

C# code snippets not working after VSIX install

We've created a number of C# code snippets. If I import them directly using the Code Snippets Manager they work perfectly as intended.
Since we are going to have people rolling into our project at different moments in time we want to ease the on-boarding process so we want to include these snippets into a VSIX project. For that purpose I followed this process to the letter.
Now there are several issues going on:
1. When I run the VSIX in debug mode I get the experimental instance of visual studio but the scripts' folder is not in the manager and the package does not seem to be installed when I look in the "Extensions and updates".
If I close VS and run the VSIX installer, after re-opening VS I can see the package installed in "Extensions and updates", I can see the custom scripts' folder in the scripts manager and all the scripts are there but, when I open a code file and try to use them they are just not available, the short cuts are not recognized and the scripts are not available in the insert script context menu.
We have tried both approaches in three different environments and the behavior is the same.
We are using Visual Studio 2017 with .Net Framework 4.7.1
I have tripled checked all the settings, made sure there aren't any typos, all the files that need to be added are there in the right place so I do not know what else to check or try.
I am sorry that I do not include any code but there are some things that are deemed confidential but I tried doing it with the Hello World example and I got the same result.
Thank you for any help you can provide.
So as it turned out, there were multiple causes for this behavior.
Environment 1: With the brand new instance of Visual Studio 2017 there was a folder in the Snippets Manager named %LCID%. Within this folder there were two snippets specifically for MVC 4 applications. We do not know why but either these snippets or the folder was preventing our custom ones to be detected, once we removed this folder everything started working as expected.
Environment 2: This environment did not have the %LCID% folder but had ReSharper installed on it and it was configured to use the IntelliJ keyboard schema. As soon as we changed it to use the Visual Studio one then the snippets became available.
Environment 3: In this one the %LCID% folder was not present and the ReSharper keyboard configuration was set to Visual Studio. We disabled ReSharper and the snippets would still not be available. We basically were never able to figure out why the snippets were not available so we ended up going to the file system, cutting them from the custom folder and pasting them under the "My Snippets" default one and they became available.
Hopefully this information will be useful for someone or, even better, somebody might be able to explain why situations one and three would cause the snippets to not be available.

Using VS2017 and VS2015 C# projects in the same location, side-by-side

Is anyone out there using Visual Studio 2015 and 2017 .CSPROJ files alongside each other in the same folder? Are there any other incompatibilites, besides the solution and project files that I should worry about?
Basically what I want to do is allow our developers to continue to use VS2015 and those projects -- just for a while -- while all still working on exact same set of same code files. I don't want to move/change anything else.
I've already created all the new project files and solution file. But 'm wondering if I can just put them in the same physical disk folder alongside each other and have everyone go merrily about their development tasks with either VS2015 or VS2017.
The duplication of work synchronizing the project files themselves is not a concern. I just want to make sure there aren't any OTHER format differences that might cause some sort of build/run problem for me.
Is anyone else out out there doing this? Is this workable?
There is not any incompatibility, but you should check when you are creating a new project in VS2017 the kind of project, you should have two things in mind, first, when you are creating .net projects, you have to keep using the old .net framework instead of .net core, and second (only if you are going to create desktop/libraries/console projects), you need to use the Common option instead the new option (check on the dropdown to select the .net framework version that allows you to select versions lower than 4.5), cause if not, then you have the incorrect kind of project selected and this kind of project doesn't work in VS2015 as they change the structure of the .csproj file. Hope this little explanation helps you.
Update
What I wanted to say with this explanation is that every projects that comes from VS2015 or 2017 if they have the same structure (same old kind of .net framework), then you can do what you want to do, but if for some reason you need to make a .net core, then this will not work.
Cheers.
Just be aware that VS2017 supports C# language version features that 2015 does not. If anyone uses those features you will not be able to build the projects in VS 2015.
You can enforce language version in the .csproj files but this is done per BuildConfiguration and can be tedious to configure for larger solutions with many projects.
To make the changes
Right click the Project and select Properties
Then Build Then
Advanced (Bottom Right corner) General > Language Version
Change to C#6.0
Overall it is possible but you may need to retain VS2015 if you have any SSIS or SSRS packages as the tooling is still not available for general release (Oct 17) and is still in preview.
You should be able to run Visual Studio 2015 and Visual Studio 2017 side by side without any issues. Our application ran on both Visual Studio 2015 and Visual Studio 2017 before every developer migrated to VS 2017.
You do need to keep in mind few things though:
Visual Studio 2017 by supports C# 7.0. Make sure that you use same language version in both the IDEs.
VS 2017 also supports stuff like editor.config. I would suggest to avoid using it (though I feel it should not be an issue)
If you are using on .NET Core project without csproj. Do not think you would be able to upgrade it.

Unable to change Platform Toolset Visual Studio 2015

I have a C# solution in Visual Studio 2015 with two projects, the applications run perfectly on Win 7 and up however, they will not run on XP. I've done the mandatory research and seen that I need to update my Platform Toolset setting and include a few dlls, however, when trying to follow the steps (as listed on this site and MS's) I do not see the options for configuring this.
An similar question on this site showed a screenshot with an example but when I try to navigate to the configuration options for this project (not solution) I do not see the "Platform Toolset" setting, much less anything else shown on the example.
Firstly, viewing the property pages of one of the projects shows an entirely different UI with no "Configuration Properties" and the only way for me to view a form similar to the example is to view the properties of the entire solution (against MS instructions)
Example
My Project Property Page
My Solution Properties
As you would see, the dialog does not offer a "General" tab and neither of the projects within the solution have the ability to view the configurations.
I've inherited this application and am not sure what was done during the creation of the solution and projects that may have caused this. Any ideas? Is there something that was done incorrectly?
Your example is from a C++ project, whereas your project is a C# project, hence why the two look completely different.
Windows XP does not support .NET 4.5, so you will have to downgrade to an earlier version of .NET (Source).
The drop-down to do this is clearly displayed in your "My Project Property Page" screenshot (labelled as "Target Framework"). The latest supported version for XP is .NET 4.
It is worth noting that Windows XP is no longer supported by Microsoft (unless you are paying for extended support - and even that runs out in a year or so). It is not recommended that it is used.

How can I choose between 32-bit or 64-bit build in C# Express?

I'm having a problem when I try to build my solution in C# Express 2008. I need to build it for 32-bit architecture, but it always build for 64-bit.
In Visual Studio 2008 I can choose the architecture, but I can't find this option in C# Express.
Is there a way to do this in C# Express?
Have a look at what the differences look like in the project file in the full Visual Studio, and hand-craft the same edits to your C# Express project - VS will respect those changes, even if it won't let you make them from within the IDE.
EDIT: As Jeff points out in the comments, if you go to Tools -> Options, tick the "Show all settings" box at the bottom left. Then under "Projects and solutions" tick "Show advanced build configurations". That will let you edit a lot more build options, including the target architecture. You may need to go through the Configuration Manager and create a "New Project Platform" however.
Even when you've done this, bear the first paragraph in mind for other options which simply aren't available within C# Express: it's still using the same build engine (msbuild) underneath, so as long as it isn't using any tooling specific to more powerful versions (e.g. the static checker for Code Contracts, only available for Premium and Ultimate) you should be fine.
Look at this question:
How to switch between debug and release in Visual C# 2010 Express?
Following same approch suggested there, you will be able to set architecture for your program in Express editions. The problem it's that,by default some "advanced" options are disabled in Express editions, but you can easyly re-eanble them.
I found it.
"Tools > Options > Project and Solutions > General > Show advanced build configurations"
Thank you all.
By default, C# Express hides solution configurations from you. However, you can change this in the Tools->Options dialog so that you can then specify new build configurations and change their platform targets.
In the project properties, you should be able to select the "Platform Target" - this can be "Any CPU", "x86", "x64", or "Itanium" for me (in VS2008). Is this selection not available in C# Express?
I was getting this error as well, since I was running a 32-bit application on a 64-bit machine. I fixed this by going to the IIS app pool and changed the support 32bit option to true.

Categories

Resources