Issue with PackageRestore, Silverlight, and MSBuild - silverlight

We use NugetPowerTools PackageRestore to avoid putting our packages folder in svn. This works building .NET projects with Visual Studio and MSBuild. It also works building Silverlight projects with Visual Studio.
However, when we use MSBuild to build Silverlight projects, the build fails. This appears to have to do with the tasks in Microsoft.Silverlight.Common.targets. Looking at the MSBuild output, it appears to get to the step GetXapOutputFile before it errors. Something either in that step, or after that step, is looking for the packages, but the package restore does not run until after all of this. Building a second time will succeed.
What is different from pressing build in Visual Studio than running MSBuild? Is there a command line switch I am missing?
If that won't work, is there some way I can change the NuGet.targets created by NuGetPowerTools or something I can put in my csproj file that will switch the order these steps are run?
I am running MSBuild Solution.sln /target:Clean;Rebuild
Edit
I've update NuGet to v1.6, removed all traces of NuGetPowerTools and I am now using the built in Package Restore option. I am still getting this error.
Edit Again
A discussion around this issue has come up again. I've tested this now with NuGet v2.0 and it is still happening.

This has been corrected in NuGet v2.1.31002.9028. The details can be found in this commit.
For existing solutions, you will need to delete ./nuget/NuGet.targets from your solution. Do this through Windows Explorer. Deleting it through Visual Studio will only remove the file from your solution, it will leave the file alone.
Once you have done this, right click on your solution and select "Enable Package Restore". This will recreate NuGet.targets with the fix.

Related

Visual Studio 2019 freezes when instantiating SOAP Webreference

I am expierencing a strange problem with Visual Studio 2019. We ware using SOAP-webreferences in our projects. When I start a project in debug mode, the debugger freezes when the SOAP reference is instantiated. Waiting ~5 minutes helps but this problem strongly impaires the development. When I start the same App without the Visual Studio debugger, everything works fine. The bottom line is that I cannot use the debugger right now.
I already tried to set a breakpoint but nothing happens when the debugger freezes - even in the console.
Visual Studio 2019 freezes when instantiating SOAP Webreference
Please try the following steps:
1) disable any third party vs installed extensions under Extensions-->Manage
Extensions to check whether there is an extension causing that.
2) reset all vs settings under Tools-->Import and Export Settings-->Reset all VS settings
3) clean nuget caches first
then run update-package -reinstall under Tools-->Nuget Package Manager-->Package Manager Console
4) close VS, delete .vs hidden folder under the solution folder, bin and obj folder
5) try to use another port under Project Porperties-->Web-->Porject Url https://localhost:<prot>/ like https://localhost:44307/
6) Or try run devenv /safemode on Developer Command Prompt for VS2019 to start a pure VS and then debug your project to test again.
7) If it does not work, you could create a new winform project in VS2019 and then migrate the old content into the new one to test whether the issue still persists. And if it succeeded, it is a better solution to avoid this issue.
If the error also happens on the new one, please repair vs or update vs.
Besides, if these do not work, please share a small sample with us so that it will help us troubleshoot your issue more quickly.

Visual Studio 2017 .sql files now building and error. How to disable

I'm working on a MVC ASP.NET project. The database sql files are in a project of their own so they can be worked on and version controlled but they aren't to be managed by Visual Studio. They used to build and have errors. Rather than working out the errors we simply decided to stop these files building. I achieved this by changing the Build Action of it to None.
I've just upgraded VS to the latest 15.5.4 with various additional installed products and now the sql files are building again despite the build action remaining at None. And giving build errors.
The additional installed products include:
SQL Server Data Tools - 15.1.61710.120
I assume it was upgraded and is behind this problem.
Does anyone know what is causing these files to build when they shouldn't? And how to stop?
A partial answer is to unload the project:
Select project in Solution Explorer
menus > Project > unload project
This requires needing to reload the project to work on it. Which is less than ideal.

Visual Studio 2013 crashing when saving Windows Forms solution

I have been working on a particular solution for a few months now without any problems. The last thing of significance that I remember doing was refactoring the name of a custom control inheriting from RichTextBox. I don't know if that is related to the problem but it seemed to be when the problems started occurring. For some reason now when I show the main form in design view and save any changes I get the message "Visual Studio has stopped working blah blah" and it restarts.
I seem to be able to load and make changes to other solutions ok.
So far I've tried:
Deleting .sln and v12.sln files
Have tried uninstalling NuGet. (I don't have any extensions other than NuGet and Visual Studio Extensions for Windows Library for JavaScript)
I don't have resharper
I have tried to start in /SafeMode but I keep getting the error "'Visual Studio Component Model Host Package' package did not load correctly". I can't seem to load any solutions in SafeMode.
Repaired VS2013 installation twice
Restarted my computer many times
Tried writing a log file using /log switch but can't really understand how to interpret it.
Any pointers would be very welcome.

Deploying ClickOnce via Mage and Visual Studio Publish Wizard

We identified that when you deploy your clickonce project via MageUI.exe, the Setup.exe or Publish.htm does not being created.
Is there anyway I could create the Setup.exe with pre-requisites included at least? We could figure a way to create a HTML page. However if there is a way to create a complete deployment package way similar to Visual Studio's wizard that would be ideal.
Thanks & Regards,
This may not work for you, but instead of compiling the code and then calling mage to create the click once, you'll need to do this using msbuild.
Using MSBUILD, there's a publish target you can call to get this working.
E.x.: msbuild WindowsFormsApplication5.sln /t:publish

Including winforms installer in UppercuT code_drop

Does anyone know how to specifically include a winforms setup project to be included in the code_drop folder generated when running UppercuTs zip.bat? With the default settings my web applications and WCF services are included, as are the dll's for the solutions core, but not my winforms application/installer
I was just playing around with UppercuT last night, and I ran into the same question.
One tip I found for putting console apps and windows services into the code_drop is to use this Nuget package in your console/windows service projects:
http://nuget.org/packages/publishedapplications
See this for more info:
http://devlicio.us/blogs/rob_reynolds/archive/2011/03/22/published-applications-aka-publishedapplications.aspx
Using this will cause your console/windows service projects to be "published" similary to how a web app is published in the code_drop. However, this isn't what you're asking for, just wanted to point it out if its useful. This also doesn't work for installers.
If your installers are using the default Visual Studio setup projects (.vdproj projects), I haven't tried that, so I can't help there. I do know that MSBuild refuses to build those types of projects (not sure why...), so you might be better off using WiX or another installer technology. You can do an automated build on a vdproj if you run the build by calling devenv.exe directly from the command line, but you can't build those with MSBuild. I did try adding a WiX setup project to my sln, and UppercuT will build the Wix setup project and drop the .msi in the "build_output" folder, but it doesn't copy it over to the code_drop. My thought would be to add a custom post build step to just copy that file over from build_output to code_drop. I haven't had a chance to figure out the logic in the build scripts to see how it chooses which files to copy from build_output to code_drop. If I figure anything out, I'll update this answer.

Resources