Why can't I create Shared Project in Visual Studio 2015? - c#

I downloaded visual studio community 2015. I tried to create a Shared Project and am getting an error:
Content from Microsoft.Windows.UI.Xaml.CSharp.targets
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(TargetPlatformVersion)'==''">
<TargetPlatformVersion>8.0</TargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP'">
<RedirectionTarget>8.2</RedirectionTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(RedirectionTarget)' == ''">
<RedirectionTarget>$(TargetPlatformVersion)</RedirectionTarget>
</PropertyGroup>
<!-- Direct 8.0 projects to 8.1 targets to enable retargeting -->
<PropertyGroup Condition="'$(RedirectionTarget)' == '8.0'">
<RedirectionTarget>8.1</RedirectionTarget>
</PropertyGroup>
<Import Project="$(RedirectionTarget)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
</Project>
I do not have folder with name 8.1

One workaround is to make the following edits:
Open the file %ProgramFiles(x86)%\MSBuild\Microsoft\VisualStudio\v14.0\CodeSharing\Microsoft.CodeSharing.CSharp.targets (for Visual Basic the file is Microsoft.CodeSharing.VisualBasic.targets) and look for the following entries around line 8 -
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets')"/>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" Condition="!Exists('$(MSBuildExtensionsPath32)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets')" />
Change these lines to the following -
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" Condition="false"/>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" Condition="true" />
Basically, undo the conditional import of the Xaml based shared projects.
This is (believe it or not) the advice I received from MS for this issue. I think it's related to an unclean upgrade of the RC (or earlier) versions to RTM and the selection of different options during install.
(Insert usual caveats about editing files that don't "belong" to you, take backups, and if you're not confident to make such edits, don't)

Try to copy 8.0 and 8.1 directories from C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0 to C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v14.0 (notice version number at the end).
It seems that those are missing in 2015 installation on windows 7.
You'll need to restart Visual Studio after that.

To fix this issue install the Windows 8/8.1 Project templates.
All I did was:
Open VS 2015
Click File->New->Project
Choose the only
Project template under Windows 8
This will launch Visual Studio setup where you can install the templates that are missing.
Then you can create your Project.

This is not a hard problem. Mr. Kriper (the original asker of the question) likely installed using the "Default Install" for his version of Visual Studio 2015. Mr. Kondrasovas in Answer 2 points to needing to install more components. His approach resulted in a Visual Studio displaying a setup utility error which is no fault of Mr. Kondrasovas. Mr. Kondrasovas answer is likely correct if you do not encounter an error (I have no way to verify the answer).
The solution is to go to Control Panel | Programs | Uninstall a program. Select Visual Studio 2015 and "Modify" the installed instance of Visual Studio 2015:
[sorry I cannot show the image b/c I do not have a 10 for a reputation and StackOverflow.com is blocking me]
The previous (imaginary) screenshot is from the default install of Visual Studio 2015 Professional. You can mess around and figure out the exact feature to install or if you have the disk space, simply click on "Select All" and then "Next". Hint: the "Next" button is not enabled until a change is made to the selected components of Visual Studio 2015.
If you want to see the missing image a complete write up, I wrote a blog post on the issue: http://www.softwarepronto.com/2015/08/visual-studio-2015-error-adding-shared.html

Related

Visual Studio not detecting Forms

I have checked out an existing WinForms using SDK-Style csproj file, and Visual Studio does not detect the forms as forms that can be designed. As such, the WinForms designer cannot be used.
I can also reproduce this issue by creating a new net6 WinForms project and then deleting the csproj.user file containing information about the SubType. After reading about similar bugs in previous Visual Studio versions, the forms should be automatically detected and added to csproj.user file. However, this does not appear to happen for me.
Visual Studio version: 17.4.4
csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>
After further testing and contact with Visual Studio support, I figured out that the issue is related to the "Run code analysis in separate process" setting. If this setting is disabled, Visual Studio does not detect the forms on its own. After enabling it, everything works as expected.

Opening VS 2015 project in VS 2017 | install Missing Features

While Opening VS 2015 project in VS 2017 getting this error of Install Missing Features
When I press on Install button the loader comes and then the error comes, after that nothing happens
Visual Studio 2017 Version Details
Stuffs Tried till now
Link 1 : Installed Microsoft Expression Blend Software Development Kit (SDK) for .NET 4
Link 2 : Not able to do any of the steps given in this link
Link 3 : Have done this setting to set proxy settings for VS2017
Env Info
Using Corporate account having proxy settings to access internet
Please help on how to proceed ahead.
This can be caused by having the Nuget Package "Microsoft.CodeDom.Providers.DotNetCompilerPlatform" installed for a project, without actually having all the package files present. (I don't know how this happens.)
Edit the project file of the unloaded project (right-click in Solution Explorer > edit). Remove this line near the top:
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
Right-click the project again > Reload Project.
Visual Studio might prompt you to restore Nuget packages. Click yes.
If it doesn't prompt you, right-click the solution in Solution Explorer > Restore Nuget Packages.

Class Diagrams in VS 2017

I have been using VS 2015 and like the Class Diagram item.
I recently upgraded to 2017 and can't seem to find the Class Diagram item.
Anyone know how I get to it?
Using VS2017 Enterprise:
Go to the Quick Launch Bar (top right) Ctrl + Q
Type "Class Designer" and an install link will pop up
Click install, restart, and your off to the races... Enjoy!
Noticed this in the beta and thought I had a bad install. The UI elements to add new Class Diagrams were missing and I was unable to open existing *.cd Class Diagram files in my solutions. Just upgraded to 2017 and found the problem remains. After some investigation it seems the Class Designer component is no longer installed by default.
Re-running the VS Installer and adding the Class Designer component restores both my ability to open and edit Class Diagrams as well as the UI elements needed to create new ones
You need to install “Visual Studio extension development” workload and “Class Designer” optional component from the Visual Studio 2017 Installer to get the feature.
See: Visual Studio Community 2017 component directory
But this kind of item is not available on all project types. Just try for yourself:
In a Console App (.NET Framework) is available;
In a Console App (.NET Core) is not available.
I couldn't find more info on future availability also for .NET Core projects.
Woo-hoo! It works with some hack!
According to this comment you need to:
Manually edit Microsoft.CSharp.DesignTime.targets located in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\Managed (for VS Community edition, modify path for other editions), append ClassDesigner value to ProjectCapability (right pane):
Restart VS.
Manually create text file, say MyClasses.cd with following content:
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Font Name="Segoe UI" Size="9" />
</ClassDiagram>
Bingo. Now you may open this file in VS. You will see error message "Object reference not set to an instance of object" once after VS starts, but diagram works.
Checked on VS 2017 Community Edition, v15.3.0 with .NETCore 2.0 app/project:
GitHub issue expected to fix in v15.5
the following procedure worked for me:
Close VS.
Run Visual Studio Installer.
Click on the 'Modify' button under 'Visual Studio Professional 2017'
In the new window, scroll down and select 'Visual Studio Extension Development' under 'Other Toolsets'.
Then on the right, if not selected yet, click on 'Class Designer'
Click on 'Modify' to confirm
VS 2017 Professional edition-
Go to Quick launch type "Class..." select Class designer and install it.
Once installed go to Add New Items search "Class Diagram" and you are ready to go.
In addition to #ericgol's answer:
In the French version of Visual Studio Community 2017, type "Concepteur de classes" in the search bar.
Open Visual Studio Installer from the Windows Start menu, or by
selecting Tools > Get Tools and Features from the menu bar in Visual
Studio.
Visual Studio Installer opens.
Select the Individual components tab, and then scroll down to the
Code tools category.
Select Class Designer and then select Modify.
The Class Designer component starts installing.
For more details, visit this link:
How to: Add class diagrams to projects
I am using VS 2017 Enterprise, you can find an option to install the class diagram extension using he Quick Launch in VS.
A further note on Dmitry's 2017 answer. I opened up
C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\MSBuild\Microsoft\VisualStudio\Managed\
Microsoft.CSharp.DesignTime.targets
and went to the <ProjectCapability> element. I already had this:
<ProjectCapability Include="
CSharp;
Managed;
ClassDesigner**;**" />
with ClassDesigner already there, and yet I was still unable to drag items to my hack-made Diagram.cd using the XML editing method Dmitry mentioned (
Manually create text file, say MyClasses.cd with following content:
<?xml version="1.0" encoding="utf-8"?> <ClassDiagram MajorVersion="1"
> MinorVersion="1">
> <Font Name="Segoe UI" Size="9" /> </ClassDiagram>
). But when I took off the semicolon off 'ClassDesigner' in that element then reopened Visual Studio, voila, I was able to drag classes from my Solution Explorer to my Diagram.cd window.
So in conclusion, this element in Microsoft.CSharp.DesignTime.targets worked:
<ProjectCapability Include="
CSharp;
Managed;
ClassDesigner" />
I am using VS 2019, version 16.1.5.

Missing references errors on Visual Studio 2015

I have a solution with a project that i developed using Visual Studio 2013 and it was working as intended. I then formatted my computer to upgrade to Windows 10 and decided to install Visual Studio 2015 instead and now I'm getting a lot of missing reference errors when they are installed, does anyone know why this is happening and how to fix it?
Some of the errors:
A good example is that I have Microsoft.Net.Http package installed but it's not recognizing it where I have using System.Web.Http;
I installed Visual Studio 2015 with the same user I'm using to run it (It's a personal computer and I'm the single user) and am running it as administrator.
If you need any extra information please leave a comment and I'll edit the question.
Update-Package in Package manager console
may sort it out if it is a missing / mismatched package issue
I had the same issue a few months ago. In my case the following two steps worked:
1) Delete the hidden .vs folder from the solution folder, it's next to the .sln file (but close visual studio first)
2) From the .csproj file, remove these entries (if they exist)
<RestorePackages>true</RestorePackages>
And
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
</Target>
I ended by creating a new project and just copying the files and only a few lines of configurations I needed from the old project and that solved it for me.

Error when building universal app for the store: "Manifest references file 'MyAppName.dll' which is not part of the payload."

I am having this error in Visual Studio 2015 when try to create app package for the store for a windows universal applicaiton:
Manifest references file 'MyAppName.dll' which is not part of the payload.
The error is in the ...\..MyAppSourcePath..\Package.appxmanifest file.
This is somehow related Manifest references file 'Bing.Maps.dll' which is not part of the payload but in my case the error shows up only when build package for the store and is related to the MyAppName.dll (where MyAppName is the name of the name of my application).
Another related question in MSDN: https://social.msdn.microsoft.com/Forums/en-US/f137091e-f550-4eab-b7e2-418149b97d40/error-appx0703-manifest-references-file-myappnamedll-which-is-not-part-of-the-payload?forum=windowsstore
It turns out this is known issue in Windows 10 SDK (Update 1.1). Reference: https://social.msdn.microsoft.com/Forums/en-US/73f2d56d-9e8e-4b57-bcfa-0a972dfd75d7/update-11-generating-store-associated-package-fails-for-a-uwp-application-with-a-winrt-component?forum=Win10SDKToolsIssues
To workaround this issue, add the below ItemGroup in your project file and regenerate the package.
<ItemGroup>
<AppxSystemBinary Include="<Assembly Mentioned in the error>" />
</ItemGroup>
For example, if the assembly name is MyAppName.dll, include:
<ItemGroup>
<AppxSystemBinary Include="MyAppName.dll" />
</ItemGroup>
This ItemGroup can be expanded if the error still occurs for other assemblies, for example:
<ItemGroup>
<AppxSystemBinary Include="MyAppName.dll" />
<AppxSystemBinary Include="OtherAssembly.dll" />
</ItemGroup>
A bug fix for the Visual Studio Tools for Universal Windows Apps (v1.1.1) is released on 5 October 2015. This update requires that you already have the UWP tools v1.1 installed. You can determine whether you have UWP tools 1.1 installed by opening About Microsoft Visual Studio from the Help menu in Visual Studio. If you have “Visual Studio Tools for Universal Windows Apps 14.0.23309.00” installed, then you have the UWP tools 1.1.
To install this update
You must have an internet connection throughout the setup process.
For machines without Visual Studio
Install Visual Studio from https://dev.windows.com/downloads.
For machines with UWP Tools 1.1 installed
Run this installer (http://go.microsoft.com/fwlink/?LinkId=627168) to update the UWP tools to v1.1.1.
For machines without UWP Tools 1.1 installed
For Visual Studio 2015 Community, Professional, and Enterprise, you can install by
Modifying your setup to install the updated tools.
Clicking on the entry for the UWP tools in the Notifications pane.
Using the Extensions and Updates dialog to update Visual Studio.
Running the installer at https://dev.windows.com/downloads, which will add the updated tools to an existing Visual Studio installation.
For Visual Studio 2015 Express for Windows
Run this installer (http://go.microsoft.com/fwlink/?LinkId=624822) to update the UWP tools to v1.1.
To confirm that you have installed the UWP tools 1.1.1 update,
Go to Programs and Features in the Windows Control Panel, and click View installed updates.
Look for “Update for Microsoft Visual Studio 2015 (KB3073097)”, version 14.0.23315
Source: https://social.msdn.microsoft.com/Forums/en-US/73f2d56d-9e8e-4b57-bcfa-0a972dfd75d7/update-11-generating-store-associated-package-fails-for-a-uwp-application-with-a-winrt-component?forum=Win10SDKToolsIssues
I had a hell of a time trying to work this out and it's a slightly different issue to what the OP posted but hopefully this will help someone else out because I couldn't find the answer on StackOverflow and finally found it here: https://social.msdn.microsoft.com/Forums/Sharepoint/en-US/65bc5999-662c-4eda-9967-e1b3031db8c4/error-appx0703-error-manifest-references-file-assetssplashscreenpng-which-is-not-part-of-the?forum=wpdevelop after many hours of mucking around and trying different things.
My error was the same except the file was for the various store and tile image files thus: "Manifest references file 'Assets\Store\StoreLogo.png' which is not part of the payload."
All the files did exist but turned out I was running Visual Studio on a VM using Parallels and the project opened through shared folders and using a UNC path. Ran the project from a mapped drive and it builds all good.
I do realise now that referencing UNC paths using a VM in Parallels Desktop has caused a few issues for me in the past. So just need to keep in mind that things should be run via a mapped drive instead to avoid this.

Categories

Resources