Create SharePoint WSP without DLL? - sharepoint

I'm trying to build a WSP using the Visual Studio 2013 template for SharePoint - without it including the primary DLL of the project.
I tried removing AssemblyInfo.cs and all the references, it still builds the DLL and includes it in the manifest.
Is there a way to configure the project so that it omits the primary DLL (even if it does build it)?
(If anyone asks the "why would you want to do that" question, i'd be happy to answer it but doing so won't help me.)
Thanks
-John

In project properties, set "Include Assembly in Package" to False. Then publish to generate your WSP file. This new WSP will not contain the DLL.

Related

Are you missing a using directive or an assembly reference error when all other dependent projects compile

Please watch this screencast as a video would say a thousand pictures:
https://dl.dropbox.com/u/84476328/ShareX/2013-10/2013-10-26_06-49-48.mp4
I recently installed Visual Studio 2013 and attempted to compile a perfectly working Visual Studio 2012 solution.
Start-up project is ShareX and I can compile all other dependent projects as shown in the screencast. When it gets to compiling the main project, it fails.
I have no idea how this could happen.
All projects are on .NET Framework 3.5.
Entire solution was fully compilable in Visual Studio 2012.
I have removed references and re-added them to no avail.
Appreciate any pointers in the right direction.
It turned out to be a problem with Nuget. The following source code changes in all the csproj files fixed it. I am linking it for future reference just in case another person stumbles across the same problem:
https://code.google.com/p/sharex/source/detail?r=742
I just experienced this problem as well (Win7, VS2012, C#, WinForms). My solution includes a personal "framework" DLL project that I reference directly, the main EXE project and a UnitTests project. I admit I moved the directory structure around a bit and hand edited the relative paths of the solution in Notepad++. A few builds/hours later I was getting hundreds of errors stemming from the framework DLL project being mysteriously missing.
Here's what fixed the situation for me:
Remove the offending project(s) from the solution.
Save the solution.
Add project(s) back to solution.
Update the project-project dependencies
Update references to the solution's project(s).
Save
Clean
Verify build order
Verify configuration manager
Rebuild solution

How to create SharePoint web part from Class Library project?

I got a SharePoint web part proejct wth the output type set to Class Library to deploy on SharePoint farm. It all bulds great no errors.
However, The project doesn't package as DWP because of the output type - In the Build menu VS2010 doesn't show Package item.
What is the way to create DWP package from this type of a project in Visual Studio 2010?
Should I create a new web part project from an empty SharePoint web part project and add the the cs files to complile and new project? or there are some good ways?
Thanks,
Val
Yes, you can create a SharePoint Web Part project in Visual Studio and then add your class library project to it. There will be an option to package your web part project into a wsp file and deploy it. Make sure you add your class library to the GAC though in the web part project.

Visual Studio 2012 doesn't convert vs2010 solution?

I opened my vs2010 solution with vs2012 but it didn't make any conversion as from 2008 to 2010 was happening. So my solution still remains the same as 10 label on it. when I make a new solution of course it has 11 label on it. I haven't got any problem running like that but I am curious. Is there any difference? if yes, how to convert into vs2012 solution?
I managed to 'convert' the solution file to change the line containing '# Visual Studio 2010' to '# Visual Studio 2012' in the .SLN file.
Manual editing of the solution file is not necessary, or recommended. Simply open the VS2010 solution in VS2012, left-click the solution (at the very top of the Solution Explorer), then use File | Save As to overwrite the original file. This will effectively convert the VS2010 solution file to a VS2012 solution file.
There are some exceptions, but mostly you'll be able to open the same project and solution files files in both VS2012 and VS2010 SP1.
VS2012 may convert projects when you first open them, but the changes are (except noted in the document linked) backward compatible with VS2010 (ie using conditionals where needed to only apply to either version when loaded) Most project types will be left entirely untouched though.
It is about Visual Studio 2012 Compatibility
If you created your assets in Visual Studio 2010 with Service Pack 1 (SP1), many of them will load and run in Visual Studio 2012 without any further action on your part.
Many assets will also open again in Visual Studio 2010 with SP1 without any issues, even after you open those assets in Visual Studio 2012
For C++ projects it makes a difference, as the 2012 compiler (VC11) will only be used on projects that are explicitly 2012, not on 2010 projects opened in VS 2012. Some C++11 improvements are available with the VC11 compiler but not with VC10 (see this SO Answer for a summary), including:
Range based for-loops
New standard library headers (atomic, mutex, thread,...)
Smaller standard library container sizes
(And more to follow when the Nov 2012 CTP is delivered to VS 2012)
In order to convert from VS 2010 project to VS2012 there is no need to manually edit the solution file or 'Save As' over the existing project. Instead:
If you decline the update when first prompted, you can update the project later by opening the Project menu and choosing Update VC++ projects... [at the top of the menu options]
From MSDN's "How to: Upgrade Visual C++ Projects to Visual Studio 2012"
(This page was linked from #Joachim's MSDN link, but I wanted to have the answer here on SO since a number of other answers suggested manual workarounds instead of this VS 2012 feature)
In my case, I had some Visual Source Safe stuff (my project was created with Visual Studio 2003/2005, yes, very old!)
Once I manually removed the VSS stuff, the conversion succeeded.
PS: I know it's about VS2010, but maybe this helps others.
You can convert a project from VS2010 to VS2012 by doing the following:
Add the 2010 project to your VS2012 solution by right-click on your solution in the Solution Explorer and Select Add --> Existing Project...
The project will appear in the solution and will have (Visual Studio 2010) appended to its name.
Right-click on the added project and select Properties.
In the Configuration Properties --> General pane, change the setting in Platform Toolset field to Visual Studio 2012 (v110)
Repeat for each configuration type, e.g. Release and Debug.
I came across this question while googling for a solution to a specific problem: MSBuild was failing to execute the Publish target against a VS2012 solution that had started life in VS2010 when called from the command line (specifically through TeamCity):
error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Windows Azure Tools\2.3\Microsoft.WindowsAzure.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
MSBuild was looking for the Azure SDK 2.3 targets in the VS10 location (C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Windows Azure Tools\2.3\Microsoft.WindowsAzure.targets). The cause is explained by Sayed Ibrahim Hashimi in a blog post and, as I understood it, boils down to some decisions they made while enabling cross-version compatibility for solution files. The solution was simple: add the VisualStudioVersion property to the MSBuild invocation, something like this:
msbuild.exe MyAwesomeWeb.sln /p:VisualStudioVersion=11.0
Practically speaking, this overrides the following in each csproj file:
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
Presumably you could get the same result by editing all of these by hand to replace 10.0 with 11.0 but that might break backwards-compatibility -- I haven't tried it. I also haven't tried an update to VS2013 to see if the problem persists.
So to wrap this up by answering the question: yes, there are some differences before you "convert" (using any of the methods offered by other answerers) and some differences remain afterwards.
This is slightly different, but along the same lines so in case it helps anyone:
I was loading a project where it looked like it was loading and then kept showing all projects as unavailable. No errors were on the migration report. I tried reloading the solution and projects many times, using various methods including suggestions here.
Finally I found a "Resolve Errors" option when right clicking on the solution in the Solution Explorer. VS went through a load process again and it worked; no problems.
I don't know what it did differently that time, but apparently it made a difference.
it's to simple just edit the .sol file
change the version to 11
like this
Microsoft Visual Studio Solution File, Format Version 12.00
Visual Studio 2012

Building wsp from post-build event command line

What is the command for building WSP from post-build event command line?
I'm adding one more image so that you can understand my exact requirement.
You can build a WSP by using MSBuild. Each SharePoint project is build with the parameter
IsPackaging=True
By adding this parameter to the msbuild command you can ensure that all WSPs will be created.
You will have to depend on external tools like makecab.exe or WSPBuilder.
http://www.developerfusion.com/community/blog-entry/8390127/tfs-teambuild-and-sharepoint-wsp-deployment-and-any-post-build-events-for-that-matter/
http://www.fftf.org/news/Jul07feed/SharePoint_Solution_Deployment_Handy_PostBuild_Events.rss.html
I found the answer from here and it works for both SharePoint 2007 and 2010.
call "C:\Program Files\WSPTools\WSPBuilderExtensions\WSPBuilder.exe" -ProjectPath $(SolutionDir) -OutputPath $(SolutionDir) -SolutionPath $(SolutionDir)
This seems to be VS2010.
If you choose the project template to be a SharePoint 2010 project then you will find items in the context menu that are related to SharePoint. If you choose deploy, it will create the wsp package automatically and deploy it to the server.
To force Visual Studio to create a wsp on post build for SharePoint solutions, add these properties to the project xml. If you already have a post build event defined, just add the two inner tags to the existing property group. Visual Studio will create the wsp in the configured location; Release or Debug.
To edit the project xml unload the project in visual studio then right-click on the project and select edit.
<PropertyGroup>
<IsDebugging>False</IsDebugging>
<PostBuildEventDependsOn>$(PostBuildEventDependsOn);CreatePackage</PostBuildEventDependsOn>
</PropertyGroup>

Sharepoint 2010 Project package: Cannot add a new project output assembly to the package

When creating a Sharepoint 2010 project in VB.NET and wanting to deploy an additional referenced assembly you cannot add a new project output assembly to the package.
To replicate the issue:
Open Sharepoint 2010 project in Visual Studio 2010
Open "package\package.Package"
Select "Advanced"
In the Additional Assemblies area select "Add | Add assembly from Project Output..."
This error is then presented:
Cannot add a new project output assembly to the package.
The path is not of a legal form.
Any ideas on what the "path" is that is not "of a legal form"?
Not sure, but sounds like you are hitting same bug as as Andrew Connell
Remove any Solution Folders from your solution and you should be able to access the Add assembly from Project Output dialog.
This has been acknowledged by MS as a bug in the current Visual Studio 2010 Beta:
http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/2201baa0-70a0-424e-931a-f20c7c4091d6

Resources