How to install a WSP that has dependant assemblies? - visual-studio-2010

I have a solution in Visual Studio 2010 that is made up of 3 projects.
I have one project for my SharePoint 2010 custom timer job, one project (Project A) that is used by my custom timer job, and another project (Project B) that is used by Project A.
The problem is that when I package my project the WSP only installs the Custom Timer Job to the GAC. Is there some way to have all dependant DLLs installed as well?

You have to add those DLLs (project references) manually into the WSP project's manifest. There's a UI in Visual Studio to assist you with this, no need to modify the XML directly.
Steps:
In Solution Explorer within your WSP project locate the Package folder.
Double-click on Package.package file to open the package designer.
In the bottom of the screen click on 'Advanced'; a screen showing 'Additional Assemblies' will open.
Click on 'Add' and select 'Add assembly from Project Output'.
Choose the assembly and deployment mode (GAC or WebApplication = bin folder).
In this dialog you can also register the associated safe controls and resources. Also, via 'Add Existing Assembly' you can add assemblies available in binary form only (i.e. not available as VS projects in source code).

Related

Visual Studio .Net Target Framework Version is grayed out

I am using Visual Studio 2015 to open a C++ CLI project and I want it to target .NET 4.5. My installed .NET version is 4.7. But I cannot edit the project's target framework because it is grayed out.
I have tried to directly edit the project's file in notepad but I couldn't find where the target framework is defined.
Below is part of the screenshot of the .vcxproj file
To complete Hao Peng's answer.
Right click on project.
Select "Unload Project"
Right click on unloaded project.
Select "Edit *.vcxproj"
Modify the "TargetFrameworkVersion" tag from "v4.7" to "v4.5"
Save and close the file
Right click on unloaded project
Select "Reload Project"
This feels a bit hacky; nevertheless, it worked for me. I moved from 4.5.2 to 4.5. YMMV.
In Visual Studio, in Solution Explorer, select your project. On the menu bar, open the Project menu and choose Unload project. This unloads the project (.vcxproj) file for your project.
In my case, I had this issue, while doing migration from .netframework to .net core.
I have multiple projects in my solution, of which base project was created with output type as Class Library and Target framework is set to '.net5.0-windows' by a tool and the other projects are created as '.netstandard 2.0'. Though the dependent projects are configured correctly in .csproj, the option in the properties is grayed out.
However, when I changed base project targetframework to '.netstandard 2.0' then the Target framework has all installed '.netstandard' versions for rest of the projects.

Reduce Workflow Foundation project build time

I am working on a WF project which has many processes and code activities in it.
The project takes too long to build (20-30 times more than any other project in the solution).
I've asked google about this, but there seems to be no information.
Please, how can I reduce the build time of a Workflow Foundation project?
The main part is probably that all XAML based composite activities get validated during build. That means, they get instantiated!
You can turn that off with an undocumented setting in the csproj file:
<SkipWorkflowValidation>true</SkipWorkflowValidation>
<DisableWorkflowCompiledExpressions>true</DisableWorkflowCompiledExpressions>
This setting must be added to all configuration sections (the relevant elements, typically, you’ll want do to this in all the configurations).
The project file (csproj or vbproj extension) can be edited in Visual Studio by following these steps:
Right-click on the project in Solution Explorer and select “Unload Project”
Right-click on the unloaded project (now shown with the “(unavailable”) postfix), and select “Edit ”
The project file opens in the Visual Studio editor and you can manually edit it.
Once you are done editing the file, you can right-click on the project in Solution Explorer and select “Reload Project”.
Try that and watch the build time. But be aware, this will skip some tests during build that might be valuable...

Adding existing project as reference with packages, references fail

I have an existing project that uses several external packages that are included through the Visual Studio NuGet interface. Let's call this project Existing
In a separate project, I want to add that project as a reference. Let's call this project Separate.
I go to Separate and I right click on the Solution in Solution Explorer, and click "Add -> Existing project". This successfully adds Existing to Separate. I then right click on Existing and click build. This causes NuGet to get all of the packages.
However, after that happens all of the references are broken in Existing ... they all have the yellow triangle over them. If I look at the file system, they were successfully downloaded in to Separate\packages.
Why can't Visual Studio find the references? It installed them.

How do I change the target platform in a console app in Visual C# 2010 Express or Visual Web Developer 2010 Express?

I don't see any other value other than 'Any CPU' in the drop down list in Properties -> Build -> Configuration -> Platform in Visual C# 2010 Express or in Visual Web Developer 2010 Express.
I just removed some 64-bit dlls and got their 32-bit versions and added a reference to them.
Since then, I've been receiving a BadImageFormatException.
Is it the platform or the platform target?
If you want to add a new platform then do this:
Open the Configuration manager for your solution.
Expand the Platform combo for the project. It will show several items: Any CPU, and .
Press This will open a new dialog to add a new target for your solution. Select x64 for the new platform and Any CPU as the target from where to copy the settings. You can also check the "Create new solution platforms" if you want to add a solution target also.
Then, if you go to the project properties you can select this platform.
I found a couple of suggestions elsewhere but they haven't worked for me so far.
I found this one to be the most useful of all.
http://social.msdn.microsoft.com/Forums/en-US/d4fa83dc-eed1-4ead-96a1-78bbd9ba6d3a/vb-express-target-x86-platform?forum=vblanguage
For anyone who faces this same problem later, here's help. It says:
Express Editions:
The VB and C# Express products do not expose the
Target property inside the development environment.
You will need to carefully modify the project file
using a text or XML editor.
1. Close the project and/or solution
2. Select Open File from the File menu
3. Navigate to the project directory, and highlight
the project file
4. Press the Open button, the project file should open
in the XML editor
5. Locate the first <PropertyGroup> section and add
the following line:
<PlatformTarget>x86</PlatformTarget>
1. Save the project file
2. Reopen the project and/or solution using
Open Project/Solution from the File menu
3. Continue with development, debugging, and testing
Alternatively, if the application is targeted to 64-bit
platforms, you can ensure that the COM controls added to
the application have 64-bit equivalents on the development
and deployment computers.
JohnWein added the following:
Using the above method targets the x86 platform, but it
doesn't show the "Configuration:" and "Platform: " boxes
on the Properties tabs. To get this feature, I made a
template of one of the projects that shows these boxes.
Now I can target a platform and know what platform I
have targeted.

How do I create a SharePoint 2010 wsp and include a webpart already built as a DLL and strong signed

I have a SharePoint 2010 Visual WebPart that is built with MSBuild (ILMerged with dependencies) and strong signed - A.dll
Separately I have a SharePoint project B that I want to use to package all my WebParts and create a B.wsp
How do I include WebPart A.dll in the feature of project B and subsequently the package so it is included and available in the resultant B.wsp?
Thanks, Confused
To add a DLL to a SharePoint Solution Package using Visual Studio 2010:
open Package from the Solution Explorer
click the Advanced tab
under Additional Assemblies, click Add > Add Existing Assembly...
locate your DLL and click OK
Note that if the WebPart A project is part of your Visual Studio solution along with SharePoint Project B, then you can use Add Assembly from Project Output instead of Add Existing Assembly. Then any changes you make to the WebPart A project will be included the next time you package Project B.

Resources