For VS2010 and before I was utilizing Web Deployment Projects (WDP) to help package my website for production deployment. I had a MSBuild script that compiled the solution in release mode. An output of that was production ready website files compiled and cleaned by the WDP.
I see for 2012 WDP have been removed, and a new tab has been created in the properties for the web application. The options are the same, but now the invocation of this is done via the Publish option (before you just compiled in release mode).
So the question is this. From an MSBuild script, how do I invoke a Publish operation? I found some old posts that...
msbuild /target:publish
would do the trick. But that doesn't seem to work in 2012.
Also, I tried in my msbuild task...
<MSBuild Properties="Configuration=Publish;"
StopOnFirstFailure="true"
Projects="$(BuildDirectory)\MySolution.sln"></MSBuild>
...but msbuild just reported "unknown configuration".
How can I have msbuild run the publish option from the command line?
It appears that there are now some other options for publishing from the command-line. Specifically something along the lines of the following seems possible now with some RC updates to Visual Studio 2012.
msbuild mywap.csproj /p:DeployOnBuild=true;PublishProfile=MyProfileName
For more details check out this post by Scott Hanselman and check out the section on Publishing.
I wasn't able to get the publish to run, but looking at the output from Visual Studio I think I have found an alternate solution. Turns out the obj\Release\AspnetCompileMerge folder has a deployable and clean version of the project. It contains byte identical files to the final output folder.
I did have to change my msbuild script to include the DeployOnBuild option...
<MSBuild Properties="Configuration=Release;DeployOnBuild=True;"
StopOnFirstFailure="true"
Projects="$(BuildDirectory)\BigWave.ALL.sln"></MSBuild>
Related
I am using TFS 2012 build option to build my web application. I have couple of console application in the solution. I want the console application output to be copied to the bin folder. In visual studio, I am doing this by using the copy command in the Post build event command option. But this does not work in TFS builds. The generated exe is not copied to the _PublishedWebsites folder in the BuildAgent directory
Possibility duplicate to Problems with MSBuild OutputPath and OutDir in TFS2010 .
Also give a try wiht this NuGet package, you can install it which will do this.
With TFS 2012 build process template, you need to custom build process template to run the script after building, like the post-build scripts feature in TFS 2013 build process template.
You can refer to this article to custom build process template to achieve your requirement.
When I try to publish an azure webjob, I get the following error:
An error occurred while creating the WebJob schedule: Could not load type 'Microsoft.IdentityModel.Clients.ActiveDirectory.ActiveDirectoryAuthenticationException' from assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
The same question is asked in Visual Studio 2015 Publish WebJobs Issue, but the accepted answer does not solve my case.
I tried to add the nuget package for ActiveDirectory version 2.16, but that didn't solve it either.
There is now a better way of scheduling WebJobs using CRON expressions, which is simpler and avoids all the Scheduler issues.
I have added a new answer to the existing question, to keep everything in context of the original answers.
See details on Visual Studio 2015 Publish WebJobs Issue
I found the solution as i have been stuck in this error for a while.
The issue turns to be that it is a bug in Visual Studio 2015 Update 3. It uses old webjobs publishing tools even if you have newer NuGet packages.
After looking at the source of the problem in the output window, Visual Studio build tools were looking for an older webjobs publishing package ver. 1.0.3 while i have 1.0.12 on my pc.
Below screen shot shows that my csproj file contains 5 publishing packages.Everytime i deploy it checks for the first condition and uses 1.0.3 while i want the build tools to use 1.0.12!
The fix for this is to unload the project in Visual Studio 2015, Edit the .csproj file and delete the older NuGet publish packages from the build targets.
Rebuild, Publish, The webjob will be deployed to Azure and a scheduler will be created with no issues!
Hope this helps.
I try to get a asp.net5 Project to build with Visual Studio Online and deploy it to azure from there. I created the project with Visual Studio 2015 RTM.
I use the guide at msdn. The guide uses a msbuild target "FileSystemPublish" to get the build to azure. But I get the error that this target does not exist:
xxxx.sln.metaproj(0,0): Error MSB4057: The target "FileSystemPublish" does not exist in the project.
Does anyone know how I get this target working or how I can deploy without this target?
I found my mistake. I missed one step. I still tried to build the sln, but you need to build the xproj file:
7.Select the Visual Studio Build step and in the Solution input browse to the .xproj. Select it and click OK.
I have a seperate MSTest project that runs tests against two other c# projects within the same solution. The tests are all MSTests and run succesfully in both the Visual Studio Test Explorer and Resharper (with MSTest set). Both are using my *.testsettings file that specifies the dependencies. Trying to get dotCover to generate coverage results gives me a FileNotFoundException on both the ddls from the referenced projects. This is similar to the exception I got with VS Test Explorer before adding dependencies in the testsettings file. Both dotCover and Resharper have the same test settings in options. Any ideas why dotCover cannot resolve the dependencies when Resharper can?
I've come across the same problem and had to do the following to get Resharper running dotCover again correctly for my solution:
Delete the resharper cache for your solution. It will be located something like :
%LOCALAPPDATA%\JetBrains\Transient\ReSharperPlatformVs14\v09\SolutionCaches\{folder with solution name in it}
Numbers may be different based on which version of Resharper you have (I have 2017.2 Ultimate).
Delete the visual studio solution cache:
{solutionfolder}\.vs\{solutionname}\v14\*.suo
Again, numbers depend on which version of visual studio you have (I have VS2015)
Finally, you may have to give a hint in the test project files to run the correct version of the .net framework. Insert the following into the <configuration> node of your app.config file in your test project(s):
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
</startup>
Again, your supported runtime depends on which version of the .net framework your project is configured to use (in my case, .net 4.5.2).
Test which use Microsoft Fakes Framework fail with exception:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to resolve profiler path from COR_PROFILER_PATH and COR_PROFILER environment variables
VS solution and builds were originally created in VS 2012 and run fine under TFS 2012 build/ controller, but not under TFS 2013. I do have Ultimate VS 2012 and Ultimate VS 2013 installed on TFS 2013 build server. While troubleshooting this issue, I changed test setting in the build definition from using "Visual Studio Test Runner" to "MSTest.exe Test Runner (VS 2010 Compatible)", and now not able to change it back as "Visual Studio Test Runner" is no longer an option in the drop-down of choices. I even replaced build template in TFS 2013 with the one in TFS 2012 but "Visual Studio Test Runner" is still not an option in the drop-down of choices in the build definition Process\Automated Tests section while editing Test Run.
How to solve the problem and get the tests which use Microsoft Fakes to run in TFS 2013 build?
I was having this exact same problem and it turned out that I had a .testsettings file created in my solution and was telling the test runner in the IDE to use it. If you are getting this error in the Visual Studio IDE, verify that you do not have a .testsettings file specified by going under the Test menu -- if there is a .testsettings file specified with a checkmark next to it, click it to remove the checkmark. I suspect the presence of the .testsettings file causes Visual Studio to initialize the test runner differently.
If this is happening on the build server, verify that your build definition does not have a .testsettings file specified; ideally, perhaps remove the file altogether from source control and/or your solution. The presence of this file can trip up a TFS build.
I got the exact same error, but in my case it was a bug in ReSharper 2017.3.1:
https://youtrack.jetbrains.com/issue/RSRP-467796
Already fixed in ReSharper 2018.1